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

500 Internal server error while stting up #2138

Open
rallek opened this issue Dec 8, 2023 · 67 comments
Open

500 Internal server error while stting up #2138

rallek opened this issue Dec 8, 2023 · 67 comments

Comments

@rallek
Copy link

rallek commented Dec 8, 2023

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

  • Home-assistant (version):
  • alexa_media (version from const.py or HA startup): 4.80
  • alexapy (version from pip show alexapy or HA startup): 2023.12.0
  • Amazon 2FA is enabled (y/n). <!---We will not debug login issues if unanswered--->: yes

Logs
Please provide logs.

Additional context

@equake
Copy link

equake commented Dec 8, 2023

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

@equake
Copy link

equake commented Dec 8, 2023

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

This comment was marked as duplicate.

@KazemaRyukuro
Copy link

KazemaRyukuro commented Dec 9, 2023

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
Copy link

wambs commented Dec 9, 2023

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
Copy link

Same here.

@isbenj
Copy link

isbenj commented Dec 10, 2023

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

@vnjrebeca
Copy link

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
Copy link

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

@wambs
Copy link

wambs commented Dec 11, 2023

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
Copy link

BenJule commented Dec 11, 2023

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

@KazemaRyukuro
Copy link

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

@Meteo02
Copy link

Meteo02 commented Dec 11, 2023

Same issue here

@lukasvrany
Copy link

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

  • Change the browser to chrome.
  • Update HA to version 2023.12.1
  • I didn't have 2FA set up on amazon, so I set it up. (This I think was the main problem why the login didn't work)
  • When adding the integration, I left the 2FA field blank (authentication was done on the amazon side)

@rallek
Copy link
Author

rallek commented Dec 12, 2023

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

@cibrenvenuti
Copy link

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

Same here. No news?

@NeilSCGH
Copy link

NeilSCGH commented Dec 13, 2023

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
Copy link

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

@jcPOLO
Copy link

jcPOLO commented Dec 13, 2023

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
Copy link
Author

rallek commented Dec 14, 2023

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
Copy link
Author

rallek commented Dec 14, 2023

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
Copy link
Author

rallek commented Dec 14, 2023

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
Copy link
Author

rallek commented Dec 14, 2023

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
Copy link

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
Copy link
Owner

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
Copy link

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
Copy link

Meteo02 commented Dec 15, 2023

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
Copy link

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
Copy link
Author

rallek commented Dec 15, 2023

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.

@jazzmonger
Copy link

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
Copy link

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
Copy link

jazzmonger commented Dec 30, 2023

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

@hpoperator86
Copy link

hpoperator86 commented Dec 30, 2023

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
Copy link

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
Copy link

rs3hc commented Jan 1, 2024

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
Copy link

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
Copy link
Collaborator

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
Copy link

gilfalko commented Jan 7, 2024

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
Copy link

raphaeldias85 commented Jan 8, 2024

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
Copy link

andrezstar2 commented Jan 29, 2024

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

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

But works :)

@rrubin0
Copy link

rrubin0 commented Feb 4, 2024

TL;DR - Alexa hates your proxy, use https.

I'm running Home Assistant Core on Docker, and I've been using Alexa Media Player for a few years now, ever since the early betas and it has proven to be solid. I recently renamed one of my dot devices, which naturally caused it to become unavailable within Home Assistant. In my attempts to add the device back, I deleted the integration to simply add it again, with a fresh list of included devices. This turned into a bit of a nightmare, as I experienced the dreaded "500 Internal Server Error" described here.

I tried numerous ways to resolve the connection. Again, it was working fine, I just wanted to add the renamed device back, so I already had 2FA established and a successful connection from Amazon to HA. I finally determined that the problem must be due my migration to NGINX using http instead of the native https connection I used to have when I originally set up Alexa MP. I tried to add a proxy rule to allow the Amazon sign in, and I also tried to add the 2FA key manually. Neither method worked.

What solved the issue for me permanently
On a hunch, I decided that I would try going back to https to see if Alexa MP could successfully connect. This worked EFFORTLESSLY using the preferred authentication method in the integration (no long key needed). It authenticated on the sign in page without hesitation, accepting the 2FA code and instantly added the integration back to my HA with my newly renamed device back online and happy. After testing successfully, I changed my firewall rules back as they were, using NGINX and http and the integration still works fine.

To temporarily enable https, I created a new subdomain with my DNS provider, then I configured LetsEncrypt certbot to issue a new certificate using the new subdomain and modified my firewall policies to:
temporarily disable my inbound https:443 -->HA directly and
created a rule to forward/translate inbound https:443 -->HA:8123.

Then I edited configuration.yaml to include:

## enable ssl to use hassio url:8123 ##
http:
  ssl_certificate: !secret ssl_cert
  ssl_key: !secret ssl_key

Then I restarted HA, which was now accessible at: https://newsubdomain.myhaserver.com:8123
I used this new address when setting up the integration so it could perform the authentication, and it continues to work after moving it all back to http and letting NGINX handle SSL as it did before.

I'm not an NGINX expert, so I'd be curious if someone smarter knows of a proxy rule that does work. For me, this was not trivial, but it was a heck of a lot faster than the other methods that I tried or were suggested in this thread and ultimately more secure too.

@jazzmonger
Copy link

It should NOT be this difficult. The sooner I can turn off Alexa, the better. We'e almost there....

@rrubin0
Copy link

rrubin0 commented Feb 4, 2024

We're already there. I'm just documenting what fixed it for me. This issue is in no way the fault of the awesome folks (who are not paid developers) who have spent countless hours to make the platform available to us (as an unsupported custom component, btw). The root cause is Amazon and the ever changing code base and authentication requirements.
Frankly, I'm amazed the maintainers of this project have kept up for so long. Alexa MP was the reason I switched to core, actually. I was such an early adopter that no add on existed. A few config modifications and hoops to jump thru are to be expected.

@dakidjersey
Copy link

dakidjersey commented Mar 23, 2024

I just got mine working 5 mins ago I cleared everything on my chrome browser cookies cash and history was all cleared I tried again and it worked

@alandtse
Copy link
Owner

Timeout errors are caused by network issues where the proxy isn't able to communicate with Amazon or alternatively your browser cannot communicate with the proxy. Disabling IPv6 on HA just for login will sometimes fix that.

@pbolo
Copy link

pbolo commented Mar 26, 2024

any news? I install e use another browser for the problem of cache of browser. But it doesn't work anyway.

@BatemanJo9
Copy link

You need to have SSL keys on your server if you are running locally. If you are not then you need to be using your cloud link from Nabu Casa. logged into HA with the cloud link AND using the same link in the Amazon login information so some nasty security thingies can be exchanged. And then be done with it and enjoy :) SSL is the key here.

@stas1000
Copy link

Same issue here. 2fa is enabled
Alexa intergration is an enrolled app
tried using http url and duck dns url without luck
500 error

image

@pbolo
Copy link

pbolo commented Apr 26, 2024

I solved it by simply changing the amazon password. after that with the new password it started working

@MaJerle
Copy link

MaJerle commented Apr 27, 2024

I solved it by simply enabling the OTP on Amazon.

@rrubin0
Copy link

rrubin0 commented Apr 27, 2024

I suspect that if you solved it simply by changing your password or by enabling OTP, then you are probably running HA over https and not through a reverse proxy, such as NGINX, correct?

@MaJerle
Copy link

MaJerle commented Apr 27, 2024

I suspect that if you solved it simply by changing your password or by enabling OTP, then you are probably running HA over https and not through a reverse proxy, such as NGINX, correct?

No reverse proxy for me.

@harobertocpf
Copy link

Hola,

¿Me podéis ayudar de una manera fácil? no soy un experto y tengo el mismo problema

gracias

@harobertocpf
Copy link

Hola,

Tengo el mismo problema y no lo consigo, ¿me podéis ayudar de una manera fácil? no soy experto

Gracias

@stas1000
Copy link

Changing password didn't work for me. I also tried switching off duck dns and nginx, restated and use only the lan ip but still get the 500 error with a captcha to progress instead of an otp populating

@rrubin0
Copy link

rrubin0 commented Apr 28, 2024

Since you switched off NGINX, try issuing a certificate using LetsEncrypt, then enable https for home assistant and try again. It should work if you're able to use https to access home assistant externally.
That works for me, but then after I switch back to using the reverse proxy, it 500's again after a while when I'm forced to reauthenticate.

@stas1000
Copy link

Thank you, I literally just got it working by fluke while having nginx and and duck dns running.
I continued to use the lan ip for the host but the only change I made was when registering the otp I only enabled the home assistant app, went through the process and it worked!
Now I have dropped back and registered the Google authenticator app after the fact.
Thank you for your help and hopefully that may work for some others in the same position

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests