pirateweather
pirateweather copied to clipboard
TimeMachine data only available before May 2023
Describe the bug
The documentation says that the time machine cannot be used for historic data within the last 5 days, and to use the forecast API instead.
Because "the last five days" isn't exactly defined, I want to make sure I can build in error handling.
If I try to hit the forecast API with a date that's too far in the past, it gives me a 400 Bad Request with the body "Requested time too early, please use https://timemachine.pirateweather.net"
. Great!
However, if I try to hit the time machine API with a date that's too recent, it gives me a 502 with the body
{
"message": "Bad Gateway",
"error": "could not JSON decode Lambda function response: statusCode validation failed"
}
Expected behavior
I would expect hitting the time machine API with a date that's too recent would return a 400 Bad Request, ideally with the latest timestamp that would be available on the time machine, but just a 400 would be fine too.
Actual behavior
Instead, I see an opaque 502 that suggests that an upstream service is returning an error.
API Endpoint
TimeMachine
Location
42.794697,-71.357407
Other details
Sample requests (requests made today, 24 December, around noon (1700UTC)
- forecast call that correctly 400s (1 Dec 23:59 ET is before "5 days ago")
https://api.pirateweather.net/forecast/REDACTED/42.794697,-71.357407,2023-12-02T04:59:59Z
- time machine call that I believe should 400, but instead 502s (since 22 Dec 23:59 ET is within 5 days)
https://timemachine.pirateweather.net/forecast/REDACTED/42.794697,-71.357407,2023-12-23T04:59:59Z
- time machine call that works normally, since it's far enough in the past
https://timemachine.pirateweather.net/forecast/REDACTED/42.794697,-71.357407,2023-12-02T04:59:59Z
Also, would it be possible to clarify when exactly the cutoff for "last 5 days" is? Is it based on UTC midnight? Or the location midnight? Or exactly (current date - 5*24h)?
Troubleshooting steps
- [X] I have searched this repository and Home Assistant Repository to see if the issue has already been reported.
- [X] I have read through the API documentation before opening this issue.
- [X] I have written an informative title.