Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fitbit reauthentication raises uncaught exception #105429

Closed
allenporter opened this issue Dec 10, 2023 · 2 comments · Fixed by #105450
Closed

Fitbit reauthentication raises uncaught exception #105429

allenporter opened this issue Dec 10, 2023 · 2 comments · Fixed by #105450

Comments

@allenporter
Copy link
Contributor

allenporter commented Dec 10, 2023

The problem

When reauth is needed, it still fails when decoding the response.

What version of Home Assistant Core has the issue?

core-2023.12.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

fitbit

Link to integration documentation on our website

https://www.home-assistant.io/integrations/fitbit/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2023-12-09 23:48:13.129 ERROR (MainThread) [homeassistant.config_entries] Error setting up entryxxx for fitbit
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/fitbit/application_credentials.py", line 60, in _post
resp.raise_for_status()
File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1059, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://api.fitbit.com/oauth2/token')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/fitbit/__init__.py", line 33, in async_setup_entry
await fitbit_api.async_get_access_token()
File "/usr/src/homeassistant/homeassistant/components/fitbit/api.py", line 159, in async_get_access_token
await self._oauth_session.async_ensure_token_valid()
File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 515, in async_ensure_token_valid
new_token = await self.implementation.async_refresh_token(self.token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 94, in async_refresh_token
new_token = await self._async_refresh_token(token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 184, in _async_refresh_token
new_token = await self._token_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/fitbit/application_credentials.py", line 48, in _token_request
return await self._post(
^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/fitbit/application_credentials.py", line 63, in _post
error_body = await resp.text() if not session.closed else ""
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1142, in text
await self.read()
File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1100, in read
self._body = await self.content.read()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 347, in read
raise self._exception
aiohttp.client_exceptions.ClientConnectionError: Connection closed

Additional information

No response

@home-assistant
Copy link

@allenporter
Copy link
Contributor Author

Ah this only happens in debug mode, so not super severe

@github-actions github-actions bot locked and limited conversation to collaborators Jan 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant