Odd problem with GY-271

GY-271 has a HMC5883 module. So, for the readings you can refer this HMC5883 Arduino code. Use a magnet and measure the values for magnetic fields in the x, y, z axis.Just check if this solves your issue.