netbymatt / ws4kp

WeatherStar 4000+
https://weatherstar.netbymatt.com
MIT License
274 stars 47 forks source link

Current Conditions "failed" #53

Closed nick02124 closed 1 month ago

nick02124 commented 1 month ago

Hello, just another minor issue I came across. After about 12 hours of running the simulator gets stuck because current conditions failed to load or just says "loading" and it doesn't retry. So I have to go in and manually refresh the page.

Firefox (latest), East Troy WI ASOS

netbymatt commented 1 month ago

This is interesting. You are correct that there is no retry, at least of the same station. But the code noted below will try every station in the list of stations received in order from nearest to furthest until it finds one with data. When I queried your location this evening that totaled 52 stations to try.

https://github.com/netbymatt/ws4kp/blob/e2d7a96971cfd4df02367d17a1ff772e74bd0a02/server/scripts/modules/currentweather.mjs#L36-L41

Next time this happens can you capture what shows up in the web developer console (Ctrl + Shift + J) and comment here. If it's not getting any stations to search, or all 50-some stations are reporting no data then there's probably an issue with the data coming from the NWS API. Here are some of the errors that may show up and help us track down what's happening.

https://github.com/netbymatt/ws4kp/blob/e2d7a96971cfd4df02367d17a1ff772e74bd0a02/server/scripts/modules/currentweather.mjs#L63

https://github.com/netbymatt/ws4kp/blob/e2d7a96971cfd4df02367d17a1ff772e74bd0a02/server/scripts/modules/currentweather.mjs#L71

nick02124 commented 1 month ago

I think it may have just been a NWS API issue. It stopped for about a week, then randomly happened again with a ton of errors related to not finding data. Here's some of them:


Failed to load resource: the server responded with a status of 404 (Not Found)

Refused to execute script from 'http://localhost:8080/scripts/custom.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Failed to load resource: api.weather.gov/gridpoints/GRB/40,65/forecast:1 
the server responded with a status of 500 ()

Error: Unable to get observations: KFEP, trying next station
 at CurrentWeather.getData (currentweather.mjs:61:12)
netbymatt commented 1 month ago

This happens a lot, unfortunately, with this API. It's not getting the attention that is weather nerds would like. There's going to be an outage (not a planned maintenance interval) the last week of this year because of problems with forecast dates being in two different years. It happened last year too and they didn't get the opportunity to fix it.