Pirate-Weather / pirate-weather-ha

Replacement for the default Dark Sky Home Assistant integration using Pirate Weather
https://pirateweather.net/
Apache License 2.0
368 stars 26 forks source link

500 Internal Server Error on API Request to Pirate Weather #310

Closed cloudbr34k84 closed 2 months ago

cloudbr34k84 commented 2 months ago

Describe the bug

A 500 Internal Server Error occurs when making an API request to Pirate Weather using the forecast URL. The error happens during the setup process in Home Assistant, preventing the integration from retrieving weather data.

Failed setup, will retry: 500, message='Internal Server Error', url='https://api.pirateweather.net/forecast/API KEY/LAT,LONG?units=si&extend=hourly&version=2'

Expected behavior

The API request should return the weather data as per the location coordinates and API call parameters (units=si, extend=hourly, version=2), allowing the Home Assistant integration to process the data successfully.

The integration should successfully retrieve forecast data from Pirate Weather, without a 500 error, and update the sensors in Home Assistant.

Actual behavior

Instead of receiving the expected weather data, the API request results in a 500 Internal Server Error, causing the integration to fail the setup process. Home Assistant attempts to retry but continues to receive the same error from Pirate Weather's API.

Home Assistant version

2024.9.1

Integration version

1.5.8

Other details

API endpoint: https://api.pirateweather.net/forecast/API KEY/LAT,LONG?units=si&extend=hourly&version=2 The issue could be related to server-side problems on Pirate Weather’s API. The error persists across multiple attempts and appears to be unrelated to rate limits or syntax errors in the request URL. A test of the API key and URL in external tools also results in the same error.

Troubleshooting steps

alexander0042 commented 2 months ago

When my "everything is down" alarm sounds, I assume it's an issue with (in order):

  1. Datetimes
  2. Node memory
  3. Node Memory

And onwards. There are a ton of fallbacks and checks in the code base at this point, which usually avoids major issues... but not this one. Of all things, it was my healthcheck- turns out a misformed request in the healthcheck code worked before, but not with the new error responses in V2.3. The fallback then failed because (you guessed it), the healthcheck also marked it as unhealthy.

In any case, really sorry for this downtime, and everything is back up and running now. Error handling improvements have been turned off, bumping to V2.3.1

cloneofghosts commented 2 months ago

@cloudbr34k84 You included your API and location in your message which I edited to remove but for some reason it's not letting me remove the revision. When including API URLs next time be careful to remove your API key from the URL.

Either way since the API is back up I will close this issue.

cloudbr34k84 commented 2 months ago

Awesome man, no need to apologise, these things happen :)