MPU9250 Magnetometer Not Working

I bought an MPU9250 sensor from Amazon, but the magnetometer is not working. The accelerometer and gyroscope are detected correctly, but I am unable to read any magnetometer data. Has anyone faced a similar issue or know how to fix it?