G-Two / homeassistant-subaru

Subaru STARLINK custom component for Home Assistant.
Apache License 2.0
54 stars 6 forks source link

API 500 on new installation #52

Closed benjaminarthurt closed 1 year ago

benjaminarthurt commented 2 years ago

Installed via HACS, adding integration returns the error details below. The same error also occured with the version of the Subaru module built into HA Core (which is why I tried the HACS version).

Logger: custom_components.subaru.config_flow Source: custom_components/subaru/config_flow.py:59 Integration: Subaru (HACS) (documentation, issues) First occurred: 1:07:39 PM (1 occurrences) Last logged: 1:07:39 PM

Unable to communicate with Subaru API: HTTP 500: <coroutine object ClientResponse.text at 0x7f6d0317c0> RequestInfo(url=URL('https://mobileapi.prod.subarucs.com/g2v21/twoStepAuthContacts.json'), method='POST', headers=<CIMultiDictProxy('Host': 'mobileapi.prod.subarucs.com', 'User-Agent': 'HomeAssistant/2022.5.5 aiohttp/3.8.1 Python/3.9', 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Cookie': 'JSESSIONID=EAA829EFAC06239B329F4007C4F7E63E; X-Oracle-BMC-LBS-Route=4f65eea550dddceedeb77fa2e2997443fe398a6302222a4a6cf6a9a4be077efb53b7bfbe45671244', 'Content-Length': '0', 'Content-Type': 'application/octet-stream')>, real_url=URL('https://mobileapi.prod.subarucs.com/g2v21/twoStepAuthContacts.json'))

Snip from Full Logs:

/usr/local/lib/python3.9/site-packages/subarulink/connection.py:334: RuntimeWarning: coroutine 'ClientResponse.text' was never awaited
  raise SubaruException("HTTP %d: %s %s" % (resp.status, resp.text(), resp.request_info))
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
2022-05-25 13:07:39 ERROR (MainThread) [custom_components.subaru.config_flow] Unable to communicate with Subaru API: HTTP 500: <coroutine object ClientResponse.text at 0x7f6d0317c0> RequestInfo(url=URL('https://mobileapi.prod.subarucs.com/g2v21/twoStepAuthContacts.json'), method='POST', headers=<CIMultiDictProxy('Host': 'mobileapi.prod.subarucs.com', 'User-Agent': 'HomeAssistant/2022.5.5 aiohttp/3.8.1 Python/3.9', 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Cookie': 'JSESSIONID=EAA829EFAC06239B329F4007C4F7E63E; X-Oracle-BMC-LBS-Route=4f65eea550dddceedeb77fa2e2997443fe398a6302222a4a6cf6a9a4be077efb53b7bfbe45671244', 'Content-Length': '0', 'Content-Type': 'application/octet-stream')>, real_url=URL('https://mobileapi.prod.subarucs.com/g2v21/twoStepAuthContacts.json'))
G-Two commented 2 years ago

I uninstalled/reinstalled the integration but have not been able to reproduce the error. HTTP 500 errors have typically been temporary outages on the Subaru side. Have you tried again with any success? Is 2FA with the official mobile app working?

Your logs do show that there is indeed an issue at connection.py:334, so thanks for sharing. But it isn't the root cause, since the HTTP 500 had already occurred, and this is just an error in the exception reporting, which unfortunately removes the useful message content (if any was provided).

benjaminarthurt commented 1 year ago

Finally got around to re-trying and was able to authenticate and integrate my forester. I'm assuming whatever this issue was back in May was related to Subaru's site and not the integration itself. Thanks!