home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.14k stars 31.12k forks source link

Spotify integration stuck at error 500 internal server error #56180

Closed AntoineGlacet closed 3 years ago

AntoineGlacet commented 3 years ago

The problem

I run the linuxserver.io container of home assistant. I tried to integrate spotify following the documentation. I used the correct redirect URI, client ID and secret. The integration UI sends me to authorization on spotify website (then, the app I created is actually authorized when I check the details of my spotify account). But then I am stuck on an internal error 500.

What is version of Home Assistant Core has the issue?

core-2021.9.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Spotify

Link to integration documentation on our website

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

Example YAML snippet

# spotify
spotify:
  client_id: <my client id>
  client_secret: <my client secret>

Anything in the logs that might be useful for us?

Logger: aiohttp.server
Source: helpers/config_entry_oauth2_flow.py:205
First occurred: 9:52:54 PM (2 occurrences)
Last logged: 10:01:57 PM

Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/lib/python3.8/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/lib/python3.8/site-packages/homeassistant/components/http/forwarded.py", line 89, in forwarded_middleware
    return await handler(request)
  File "/usr/lib/python3.8/site-packages/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/lib/python3.8/site-packages/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/lib/python3.8/site-packages/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/lib/python3.8/site-packages/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/usr/lib/python3.8/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 421, in get
    await hass.config_entries.flow.async_configure(
  File "/usr/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 202, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 260, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/usr/lib/python3.8/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 297, in async_step_creation
    token = await self.flow_impl.async_resolve_external_data(self.external_data)
  File "/usr/lib/python3.8/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 169, in async_resolve_external_data
    return await self._token_request(
  File "/usr/lib/python3.8/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 205, in _token_request
    resp.raise_for_status()
  File "/usr/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1000, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://accounts.spotify.com/api/token')

Logger: aiohttp.server
Source: components/spotify/config_flow.py:42
First occurred: 9:52:54 PM (1 occurrences)
Last logged: 9:52:54 PM

Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/lib/python3.8/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/lib/python3.8/site-packages/homeassistant/components/http/forwarded.py", line 89, in forwarded_middleware
    return await handler(request)
  File "/usr/lib/python3.8/site-packages/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/lib/python3.8/site-packages/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/lib/python3.8/site-packages/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/lib/python3.8/site-packages/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/usr/lib/python3.8/site-packages/homeassistant/components/config/config_entries.py", line 146, in get
    return await super().get(request, flow_id)
  File "/usr/lib/python3.8/site-packages/homeassistant/helpers/data_entry_flow.py", line 95, in get
    result = await self._flow_mgr.async_configure(flow_id)
  File "/usr/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 202, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 260, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/usr/lib/python3.8/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 308, in async_step_creation
    return await self.async_oauth_create_entry(
  File "/usr/lib/python3.8/site-packages/homeassistant/components/spotify/config_flow.py", line 42, in async_oauth_create_entry
    spotify = Spotify(auth=data["token"]["access_token"])
  File "/usr/lib/python3.8/site-packages/spotipy/client.py", line 166, in __init__
    self._build_session()
  File "/usr/lib/python3.8/site-packages/spotipy/client.py", line 193, in _build_session
    retry = urllib3.Retry(
TypeError: __init__() got an unexpected keyword argument 'allowed_methods'

Additional information

No response

probot-home-assistant[bot] commented 3 years ago

Hey there @frenck, mind taking a look at this issue as it has been labeled with an integration (spotify) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


spotify documentation spotify source (message by IssueLinks)

ludeeus commented 3 years ago

The container provided by linuxserver is not supported, please report your issue to them, or switch to our container https://www.home-assistant.io/installation/linux#install-home-assistant-container. Thanks :+1: