alandtse / alexa_media_player

This is a custom component to allow control of Amazon Alexa devices in Home Assistant using the unofficial Alexa API.
Apache License 2.0
1.42k stars 274 forks source link

500 Internal server error while stting up #2138

Closed rallek closed 1 month ago

rallek commented 8 months ago

IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.

see also #2136

Describe the bug

I am new to HA and want to install Alexa Media Player. All went fine until I have to do the captcha. There I am running into a 500 error. Even if I want to get a new picture. The path I have mydomain.org:8123/auth/alexamedia/proxy/verify

To Reproduce

fresh install restart Home assistant add integration alexa media player fill the configuration (amazon unser, amazon, password, amazon.de for region, home assistant url, 2FA key) and send check the OTA key

login for alexa is comming up prefilled amazon login and password press button to login

captcha is showing (/auth/alexamedia/proxy/ap/signin/144-3911749-1675617) clicking on "neue Zeichen anzeigen" causes an 500 (Server got itself in trouble) or filling the captcha question is doing the same

Expected behavior

The integration shall install proper

Screenshots

System details

Logs Please provide logs.

Additional context

equake commented 8 months ago

Having the exactly same issue. My 2FA is disabled.

equake commented 8 months ago

I'm having an timeout error. HASS logs below:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/anyio/streams/tls.py", line 133, in _call_sslobject_method
    result = func(*args)
             ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/ssl.py", line 921, in read
    v = self._sslobj.read(len)
        ^^^^^^^^^^^^^^^^^^^^^^
ssl.SSLWantReadError: The operation did not complete (read) (_ssl.c:2580)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/anyio/_core/_tasks.py", line 115, in fail_after
    yield cancel_scope
  File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 34, in read
    return await self._stream.receive(max_bytes=max_bytes)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/streams/tls.py", line 198, in receive
    data = await self._call_sslobject_method(self._ssl_object.read, max_bytes)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/streams/tls.py", line 140, in _call_sslobject_method
    data = await self.transport_stream.receive()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 1103, in receive
    await self._protocol.read_event.wait()
  File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait
    await fut
asyncio.exceptions.CancelledError: Cancelled by cancel scope 7f1b74e2bad0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
    yield
  File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 32, in read
    with anyio.fail_after(timeout):
  File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.11/site-packages/anyio/_core/_tasks.py", line 118, in fail_after
    raise TimeoutError
TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions
    yield
  File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 366, in handle_async_request
    resp = await self._pool.handle_async_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
    response = await connection.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 103, in handle_async_request
    return await self._connection.handle_async_request(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpcore/_async/http11.py", line 133, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.11/site-packages/httpcore/_async/http11.py", line 111, in handle_async_request
    ) = await self._receive_response_headers(**kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpcore/_async/http11.py", line 176, in _receive_response_headers
    event = await self._receive_event(timeout=timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpcore/_async/http11.py", line 212, in _receive_event
    data = await self._network_stream.read(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 31, in read
    with map_exceptions(exc_map):
  File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ReadTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/alexa_media/config_flow.py", line 897, in wrapped
    return await cls.handler(request, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/authcaptureproxy/auth_capture_proxy.py", line 439, in all_handler
    resp = await getattr(self.session, method)(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1848, in post
    return await self.request(
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1530, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1617, in send
    response = await self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
    response = await self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
    response = await self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1719, in _send_single_request
    response = await transport.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 365, in handle_async_request
    with map_httpcore_exceptions():
  File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ReadTimeout
cibrenvenuti commented 8 months ago

Same issue of OP here

KazemaRyukuro commented 8 months ago

is it on all versions of the plugin or only on the newest? Because i have the same error.

EDIT: same error on other versions

wambs commented 8 months ago

Hi, I'm a new users as well. Just tried to install Alexa Media Player and I'm getting failure to install. Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble. Logger: aiohttp.server Source: requirements.py:274 First occurred: 2:04:51 PM (3 occurrences) Last logged: 2:13:42 PM

Error handling request Traceback (most recent call last): File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/components/http/ban.py", line 80, in ban_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/components/http/headers.py", line 31, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/components/http/view.py", line 148, in handle result = await handler(request, request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/components/http/decorators.py", line 63, in with_admin return await func(self, request, *args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/components/config/config_entries.py", line 147, in post return await super().post(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/components/http/data_validator.py", line 72, in wrapper result = await method(view, request, data, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/helpers/data_entry_flow.py", line 71, in post result = await self._flow_mgr.async_init( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/config_entries.py", line 846, in async_init flow, result = await task ^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/config_entries.py", line 864, in _async_init flow = await self.async_create_flow(handler, context=context, data=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/config_entries.py", line 966, in async_create_flow handler = await _async_get_flow_handler( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/config_entries.py", line 2063, in _async_get_flow_handler await _load_integration(hass, domain, hass_config) File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/config_entries.py", line 2039, in _load_integration await async_process_deps_reqs(hass, hass_config, integration) File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/setup.py", line 420, in async_process_deps_reqs await requirements.async_get_integration_with_requirements( File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/requirements.py", line 52, in async_get_integration_with_requirements return await manager.async_get_integration_with_requirements(domain) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements await self._async_process_integration(integration, done) File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/requirements.py", line 186, in _async_process_integration await self.async_process_requirements( File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/requirements.py", line 245, in async_process_requirements self._raise_for_failed_requirements(name, missing) File "/snap/home-assistant-snap/578/lib/python3.11/site-packages/homeassistant/requirements.py", line 274, in _raise_for_failed_requirements raise RequirementsNotFound(integration, [req]) homeassistant.requirements.RequirementsNotFound: Requirements for alexa_media not found: ['alexapy==1.27.10'].

MrsXenchen commented 8 months ago

Same here.

isbenj commented 8 months ago

same here Requirements for alexa_media not found: ['alexapy==1.27.10'].

vnjrebeca commented 8 months ago

same here Requirements for alexa_media not found: ['alexapy==1.27.10'].

You have to install alexapy. search for it in the already solved issues.

KazemaRyukuro commented 8 months ago

Where should I install what? When I search for alexapy in the issues, I get what feels like 100 results.

wambs commented 8 months ago

When I run the following, pip tells me that 1.25.5 is already installed.

pip install alexapy Requirement already satisfied: alexapy in /usr/lib/python3.6/site-packages (1.25.5) Requirement already satisfied: simplejson in /usr/lib64/python3.6/site-packages (from alexapy) (3.19.2) Requirement already satisfied: requests in /usr/lib/python3.6/site-packages (from alexapy) (2.24.0) Requirement already satisfied: certifi in /usr/lib/python3.6/site-packages (from alexapy) (2018.1.18) Requirement already satisfied: authcaptureproxy<2,>=1 in /usr/lib/python3.6/site-packages (from alexapy) (1.1.2)

When I attempt to install 1.27.10, I get the following: pip install alexapy==1.27.10 ERROR: Could not find a version that satisfies the requirement alexapy==1.27.10

BenJule commented 8 months ago

Same issue here! Try this Fix: https://www.youtube.com/watch?v=giyo6Pv3GLo

KazemaRyukuro commented 8 months ago

My Homeassistant tells me that i have alexapy 1.27.10 installed. But it doesn´t change anything on the error 500.

Meteo02 commented 8 months ago

Same issue here

lukasvrany commented 8 months ago

I had the same problem and the following procedure helped me.

rallek commented 8 months ago

I did like @lukasvrany did but still I have the 500 error.

cibrenvenuti commented 8 months ago

I did like @lukasvrany did but still I have the 500 error.

Same here. No news?

NeilSCGH commented 8 months ago

Hello, I recently discovered a solution that resolved this issue for me. When you’re in your 2FA settings on Amazon, make sure to FULLY enable 2FA.

I had already activated 2FA with SMS, but it wasn’t fully activated. I was able to generate the OTP secret code and so on, but the Alexa Media Player was giving me a 500 error.

I noticed a button to enable 2FA located below the button to create a new code. After fully enabling 2FA and generating a new OTP "master" code, which I then provided to the Alexa Media Player, the 500 error disappeared.

Cocodomotico commented 8 months ago

I had the same problem. I did clean cookies and cache, cheked my amazon password, and everything is working right now.

jcPOLO commented 8 months ago

Hello, I recently discovered a solution that resolved this issue for me. When you’re in your 2FA settings on Amazon, make sure to FULLY enable 2FA.

I had already activated 2FA with SMS, but it wasn’t fully activated. I was able to generate the OTP secret code and so on, but the Alexa Media Player was giving me a 500 error.

I noticed a button to enable 2FA located below the button to create a new code. After fully enabling 2FA and generating a new OTP "master" code, which I then provided to the Alexa Media Player, the 500 error disappeared.

Same error but this worked for me. Thanks

rallek commented 8 months ago

Hello, I recently discovered a solution that resolved this issue for me. When you’re in your 2FA settings on Amazon, make sure to FULLY enable 2FA.

I had already activated 2FA with SMS, but it wasn’t fully activated. I was able to generate the OTP secret code and so on, but the Alexa Media Player was giving me a 500 error.

I noticed a button to enable 2FA located below the button to create a new code. After fully enabling 2FA and generating a new OTP "master" code, which I then provided to the Alexa Media Player, the 500 error disappeared.

how your 2FA is implemented? Do you use the mail from Amazon or do you use another autenticator app?

rallek commented 8 months ago

I now renewed the 2FA three times, including the final finishing of implementation, as @jcPOLO told us. But the error still is the same (and I can not renew the login challenge, also the 500 is comming)

Any hints on how exactly we have to proceed? I followed the instruction of this wiki here.

What I do have: I do use a dns forwarding to my installation. If I am using the internal IP I do have the same 500 error. I am connected to amazon.de

rallek commented 8 months ago

Now I have learned how to provide log information. I hope this will help find out what I am doing wrong or where the bug is sitting... fresh_log.txt

rallek commented 8 months ago

just one mor info: I checked my alexapy. It was not installed. I did the install via pip install alexapy Now it is 1.27.10 I restarted HA and tried again to add the integration. Still 500. Tomorrow I will start from scratch, today I have to leave. updated_log.txt

PizzaPino commented 8 months ago

Hello, I recently discovered a solution that resolved this issue for me. When you’re in your 2FA settings on Amazon, make sure to FULLY enable 2FA.

I had already activated 2FA with SMS, but it wasn’t fully activated. I was able to generate the OTP secret code and so on, but the Alexa Media Player was giving me a 500 error.

I noticed a button to enable 2FA located below the button to create a new code. After fully enabling 2FA and generating a new OTP "master" code, which I then provided to the Alexa Media Player, the 500 error disappeared.

This fixed it for me thanks. How the hell is anyone supposed to get this?? This really needs to be reflected in the docs.

alandtse commented 8 months ago

This fixed it for me thanks. How the hell is anyone supposed to get this?? This really needs to be reflected in the docs.

It's literally the first thing in the install instructions. But please feel free to edit the wiki to make it more obvious since you missed it.

PizzaPino commented 8 months ago

It's literally the first thing in the install instructions. But please feel free to edit the wiki to make it more obvious since you missed it.

you’re right. I skipped that section and went right to the “in-app Authenticator” section because I thought the external Authenticator section wasn’t relevant in that setup.

Meteo02 commented 8 months ago

I solved this way:

  1. I went to my Two-Step Verification settings and disabled it, clearing my settings too (there is a checkbox to clear them)
  2. I enabled Two-Step Verification again setting the Authenticator APP as preferred method (before I had text message as preferred method). I also checked the box to not ask again OTP on this browser
  3. I installed the dev version of Alexa Media Player
  4. I restarted the ha docker container and the reverse proxy container
  5. I opened home assistant using my public duckdns hostname (with https)
  6. I setup the Alexa Media Player with email, password, domain (mine is amazon.it) and URL (I used the duckdns url with https protocol). I left 2FA key empty
  7. In the Alexa Sign in page I cleared the password field and typed it manually
  8. For the first time the next page was not a captcha, but it asked for otp. After filling it the integration was installed
KazemaRyukuro commented 8 months ago

OK. I think the problem is solved. At least it works for me with the instructions.

I solved this way:

  1. I went to my Two-Step Verification settings and disabled it, clearing my settings too (there is a checkbox to clear them)
  2. I enabled Two-Step Verification again setting the Authenticator APP as preferred method (before I had text message as preferred method). I also checked the box to not ask again OTP on this browser
  3. I installed the dev version of Alexa Media Player
  4. I restarted the ha docker container and the reverse proxy container
  5. I opened home assistant using my public duckdns hostname (with https)
  6. I setup the Alexa Media Player with email, password, domain (mine is amazon.it) and URL (I used the duckdns url with https protocol). I left 2FA key empty
  7. In the Alexa Sign in page I cleared the password field and typed it manually
  8. For the first time the next page was not a captcha, but it asked for otp. After filling it the integration was installed
rallek commented 8 months ago

I tried it exactly (?) like @Meteo02 told. I do have not a docker, I do have my installation at a NUC (hass). My dns do not provide https, so I used http for step 5 in step 8 the captcha is showing and I am not asked for the otp I am ending in my 500 error page.

KazemaRyukuro commented 8 months ago

I tried it exactly (?) like @Meteo02 told. I do have not a docker, I do have my installation at a NUC (hass). My dns do not provide https, so I used http for step 5 in step 8 the captcha is showing and I am not asked for the otp I am ending in my 500 error page.

I don't have Homeassistant with docker either. So I have Homeassistant OS on Raspberry Pi. Have you set your authenticator as the preferred method? Normally you should not be shown a captcha prompt, but the prompt for the 2FA code. and do you have Nabu Casa Cloud active? In my case, the configurator has inserted the URL of my linked account.

rallek commented 8 months ago

Have you set your authenticator as the preferred method? Normally you should not be shown a captcha prompt, but the prompt for the 2FA code.

Yes, my authenticator app is the preferred one (I tried almost everything possible here). The captha of the Alexa login is shown. This login is failing and I do not know why.

and do you have Nabu Casa Cloud active? In my case, the configurator has inserted the URL of my linked account.

no, I do not have a Nabu Casa Cloud account. Is it required for this integration?

fabio-monzeglio commented 8 months ago

I tried it exactly (?) like @Meteo02 told. I do have not a docker, I do have my installation at a NUC (hass). My dns do not provide https, so I used http for step 5 in step 8 the captcha is showing and I am not asked for the otp I am ending in my 500 error page.

same issue

KazemaRyukuro commented 8 months ago

Have you set your authenticator as the preferred method? Normally you should not be shown a captcha prompt, but the prompt for the 2FA code.

Yes, my authenticator app is the preferred one (I tried almost everything possible here). The captha of the Alexa login is shown. This login is failing and I do not know why.

and do you have Nabu Casa Cloud active? In my case, the configurator has inserted the URL of my linked account.

no, I do not have a Nabu Casa Cloud account. Is it required for this integration?

i didn´t know if it´s required. But i have it enabled.

mnabaci commented 8 months ago

Same issue here! Try this Fix: https://www.youtube.com/watch?v=giyo6Pv3GLo

This has worked for me! - Thanks :)

rallek commented 8 months ago

For some it is working for others not :-( What is different for me than for others...

raphaeldias85 commented 7 months ago

I tried all differents "solutions" for some here, but no luck. Still same error on the log.

2023-12-28 01:55:24.011 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/anyio/streams/tls.py", line 133, in _call_sslobject_method result = func(*args) ^^^^^^^^^^^ File "/usr/local/lib/python3.11/ssl.py", line 921, in read v = self._sslobj.read(len) ^^^^^^^^^^^^^^^^^^^^^^ ssl.SSLWantReadError: The operation did not complete (read) (_ssl.c:2580)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/anyio/_core/_tasks.py", line 115, in fail_after yield cancel_scope File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 34, in read return await self._stream.receive(max_bytes=max_bytes) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/anyio/streams/tls.py", line 198, in receive data = await self._call_sslobject_method(self._ssl_object.read, max_bytes) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/anyio/streams/tls.py", line 140, in _call_sslobject_method data = await self.transport_stream.receive() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 1103, in receive await self._protocol.read_event.wait() File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait await fut asyncio.exceptions.CancelledError: Cancelled by cancel scope 7faf7d429a50

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions yield File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 32, in read with anyio.fail_after(timeout): File "/usr/local/lib/python3.11/contextlib.py", line 155, in exit self.gen.throw(typ, value, traceback) File "/usr/local/lib/python3.11/site-packages/anyio/_core/_tasks.py", line 118, in fail_after raise TimeoutError TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions yield File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 366, in handle_async_request resp = await self._pool.handle_async_request(req) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request raise exc File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request response = await connection.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 103, in handle_async_request return await self._connection.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpcore/_async/http11.py", line 133, in handle_async_request raise exc File "/usr/local/lib/python3.11/site-packages/httpcore/_async/http11.py", line 111, in handle_async_request ) = await self._receive_response_headers(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpcore/_async/http11.py", line 176, in _receive_response_headers event = await self._receive_event(timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpcore/_async/http11.py", line 212, in _receive_event data = await self._network_stream.read( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 31, in read with map_exceptions(exc_map): File "/usr/local/lib/python3.11/contextlib.py", line 155, in exit self.gen.throw(typ, value, traceback) File "/usr/local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ReadTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 543, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 114, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 233, in auth_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle result = await handler(request, request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/alexa_media/config_flow.py", line 897, in wrapped return await cls.handler(request, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/authcaptureproxy/auth_capture_proxy.py", line 439, in all_handler resp = await getattr(self.session, method)( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1848, in post return await self.request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1530, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1617, in send response = await self._send_handling_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1645, in _send_handling_auth response = await self._send_handling_redirects( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects response = await self._send_single_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1719, in _send_single_request response = await transport.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 365, in handle_async_request with map_httpcore_exceptions(): File "/usr/local/lib/python3.11/contextlib.py", line 155, in exit self.gen.throw(typ, value, traceback) File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ReadTimeout

jazzmonger commented 7 months ago

Same issue here after I changed my Amazon password. I keep getting unknown error occurred. 2FA is on and I quickly generate the code on the Amazon site and paste it in the integration config.

It shouldn't be this difficult....

image

The ONLY way to get this working is to DELETE the integration and add it back. Then Follow the steps in this video. Ignore that it's in German. https://www.youtube.com/watch?v=giyo6Pv3GLo

jazzmonger commented 7 months ago

@alandtse, Your integration issues section is littered with dozens of folks struggling with this same captcha/registration issue.  I've been using your integration since you first released it and every time I change my Amazon password I'm reminded of what a total nightmare this is.  Don't get me wrong - Once it works, it's works really, really well, and I appreciate the work that went into it.  Getting there is just plain painful.  

There has to be something that can be done to help mitigate all of this.  Perhaps a few more message prompts or a link to a list of things folks can try when errors are detected? I mean after hours of frustration, I had to literally uninstall the integration completely and reinstall it to get it to work after just a password change on Amazon.  

Perhaps a video demonstration in English - the German one is dead nuts perfect, but you have to guess what he's doing while he's doing it as my German is limited to swear words only.  I've  struggled with this so many times at this point that I can follow along with him and anticipate what he was doing. But, it shouldn't be this hard...

Granted, I'm now using a Willow/WIS local STT server and only pass commands to Alexa that HA doesn't understand, so Alexa's crappy, invasive life in my house is soon to be terminated. But not everyone is able to use a truly local voice system like Willow, Yet... so Alexa really does have a place in the Year of Voice in HA.

marco-nitschke commented 7 months ago

Finally I got everything running with support from the video mentioned above and a complete new install. I updated to the beta version of home assistant: Core 2024.1.0b2, Supervisor 2023.12.1, Operating System 11.3.rc1, Frontend 20231228.0 and the latest version of the alexa player. 2FA has to be setup in Amazon.

jazzmonger commented 7 months ago

Finally I got everything running with support from the video mentioned above and a complete new install.

So, fresh install with no other integrations? Or??? "Complete new install" could also mean remove the integration and add it back.

hpoperator86 commented 7 months ago

caution: i have just removed aexa_media_player from HACS and wanted to reinstall it, i got the following message: This message is displayed for all versions. So one problem leads to the next problem Screenshot 2023-12-30 113656

jazzmonger commented 7 months ago

Can you edit your post and translate the error msg? My German is limited to swear words only...

hpoperator86 commented 7 months ago

in the error message: You are using the Home Assistant version '2023.12.4', but this repository requires the minimum version '2024.1.0b0' to be installed.

Very, very strange. Why should I update to a beta version of HA to install this version? I have a working network at home, so it is logical that I only install the stable version of HA on my system

marco-nitschke commented 7 months ago

Finally I got everything running with support from the video mentioned above and a complete new install.

So, fresh install with no other integrations? Or??? "Complete new install" could also mean remove the integration and add it back.

First I removed the Alexa Player integration, then updated Home Assistant to the beta version and then renstalled the integration and went through the config process.

rs3hc commented 7 months ago

I also run into 500 Internal Server Error - Server got itself in trouble

2FA is enabled !!

Alexa Media Player - v4.9.0

Home Assistant Core: 2024.1.0b3 Supervisor: 2023.12.1 Operating System: 11.3.rc1 Frontend: 20231228.0

Running HASS on a RaspPi4 behind a Fritzbox 7590 AX with working DuckDNS and SSL encryption

jazzmonger commented 7 months ago

i don't understand why the creators don't comment on this. This problem has existed for too long, a "we're still working on it and are looking at how we can fix it" would be enough. As a user, I also take the trouble to create an almost 8-minute video in which I have to anonymize everything and post the circumstances, but not a single sign of life from the developers. @alandtse @keatontaylor

It's pretty brutal. Honestly I can't wait to ditch Alexa. The Willow project is getting us very close.

keatontaylor commented 7 months ago

Understand that this is not a full-time project for myself or any of the other maintainers, it is a pet project that I started years ago based on the excellent work of yet another person who enjoyed hacking away at things in our free time.

Both @alandtse and I are not Amazon developers and as mentioned in the readme, this code mimics the Alexa app to the best of its ability, things can break when Amazon changes things or outright stop working if Amazon decides to cut us off.

Amazon themselves has an entire team of engineers dedicated to the development of the Alexa App, when here we have a handful of developers who make improvements, fix bugs, etc. in their spare time.

Additionally throughout the life of this project, it has been extremely clear that the Amazon Alexa API has nuances and variations for each regional location, small code changes and catches for things that exist in the North American region and do not exist elsewhere. As this project is based on reverse engineering that Amazon Alexa API it is impossible for the small community of supporters on this project to account for and deal with every single variation across those regional locations.

I do want you to know that I understand your frustration and I do wish I had better answer for you, but I hope the above gives you some insight into the fact that at the end of the day it is impossible for us to account for every single issue and variation.

gilfalko commented 7 months ago

Just dropping by to give my 2 cents:

It appears that you can get a 2FA Key from your Amazon account WITHOUT actually turning the freaking thing on. You need to first TURN ON 2FA for your account in general and then it'll work.

raphaeldias85 commented 7 months ago

I think the problem I had was that I entered too many times the password and I noticed that amazon was trying to discover if I was a bot. Maybe because sometimes I used a wrong password too.

So I changed to SMS 2FA, my ISP public IP (rebooted the router to get another public IP from my ISP) and got the last version of alexa_media.

For now it is working okay for me.

andrezstar2 commented 6 months ago

Edit: Well it works. Thanks a lot dear all!!!

it got stucked with the: "Loading next step for Alexa Media Player" message

But works :)