WiFi functions timing out

I’m trying to use the WiFi functions to send some connection data over MQTT, but for some reason, the RSSI() function is returning 2, and the SSID function only works the first time, not on future requests. I’m sending this data every 5 minutes as part of some other diag data I use internally.

This is what i use to send

StaticJsonDocument<250> json;
json["network"]["ssid"] = WiFi.SSID();
json["network"]["signalquality"] = (int8_t) WiFi.RSSI();
json["photon"]["freemem"] = System.freeMemory();
json["photon"]["uptime"] = System.uptime();
json["photon"]["appid"] = g_appid;

and this is what comes over the line

{"network":{"ssid":"","signalquality":2},"photon":{"freemem":41424,"uptime":8,"appid":71}}

But the SSID call works at startup in a different message

{"device":{"AS3935":{"disturbers":"MASKED","indoor":"FALSE","noisefloor":2,"watchdog":2,"spikereject":8,"threshold":5}},"time":{"timezone":-5,"now":1586010230},"network":{"ssid":"Office"},"photon":{"id":"***","version":"1.5.0","appid":71}}

Why would these calls just not work? Is there some sort of restriction on when or how they can be called? It’s not in the documentation, and the RSSI call returns 2, so I know it’s a timeout. I also know WiFi is up, the message gets sent. Note that I just migrated to 1.5.0, this still happened in 1.4.4 as well.

Edit
Sometimes the calls DO work. I still don’t know why though.

{"network":{"ssid":"Office","signalquality":-61},"photon":{"freemem":42448,"uptime":315,"appid":73}}

Thanks for any help.