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

not able to install - failing at final step (KeyError: 'public_url') #2554

Closed
MikeatLorne opened this issue Sep 22, 2024 · 35 comments
Closed

Comments

@MikeatLorne
Copy link

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.

Describe the bug

I am installing Alexa Media player (I've done it before) and it is failing on the final login to Amazon via home assistant

To Reproduce

  1. Go to 'integrations - select alexa_media_player
  2. Click on multiple steps including access to Amazon.com
  3. Fails to update after final entry of Amazon password
  4. See error

Expected behavior

successful installation - but it stops after final password entry

Screenshots

System details

  • Home Assistant version: 2024.09.1
  • alexa_media version (from const.py or HA startup log):
  • alexapy version (from pip show alexapy in homeasssistant container or HA startup log):
  • Is Amazon 2FA/2SV enabled <!---We will not debug login issues if unanswered---> (y/n):
  • Amazon Domain: amazon.com

Debug Logs (alexa_media & alexapy)
2024-09-22 11:14:42.207 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration alexa_media which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-09-22 11:14:42.815 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {'device_tracker', 'amberelectric', 'media_source', 'assist_pipeline', 'group', 'template', 'history', 'xiaomi_ble', 'mobile_app', 'default_config', 'bluetooth_adapters', 'frigate', 'scene', 'counter', 'logbook', 'watchman', 'tts', 'tesla_custom', 'onboarding', 'input_text', 'variable', 'blueprint', 'application_credentials', 'bureau_of_meteorology', 'backup', 'lifx', 'script', 'hacs', 'zone', 'lovelace', 'integration', 'automation', 'conversation', 'powerwall', 'tasmota', 'intent', 'sun', 'search', 'nut', 'config', 'stt', 'diagnostics', 'persistent_notification', 'energy', 'format_ble_tracker', 'stream', 'image_upload', 'ffmpeg', 'sensor', 'hardware', 'localtuya', 'homeassistant_alerts', 'analytics', 'input_select', 'input_datetime', 'trace', 'system_health', 'ocpp', 'input_button', 'schedule', 'esphome', 'alexa_media', 'systemmonitor', 'file_upload', 'mbapi2020', 'sonos', 'input_boolean', 'device_automation', 'smartthinq_sensors', 'wake_word', 'statistics', 'tag', 'timer', 'mqtt', 'map', 'samsungtv', 'my', 'input_number', 'person', 'min_max'}
2024-09-22 11:14:43.457 INFO (MainThread) [homeassistant.setup] Setting up alexa_media
2024-09-22 11:14:43.458 ERROR (MainThread) [homeassistant.setup] Error during setup of component alexa_media
File "/config/custom_components/alexa_media/init.py", line 189, in async_setup
2024-09-22 11:14:43.460 INFO (MainThread) [homeassistant.setup] Setup of domain alexa_media took 0.00 seconds
2024-09-22 11:15:11.462 INFO (MainThread) [homeassistant.components.automation.automatic_updates_alexa_integration] Initialized trigger Automatic updates - Alexa integration
2024-09-22 11:17:27.650 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7f4110b62f50>, '/usr/local/lib/python3.12/site-packages/certifi/cacert.pem', None, None) inside the event loop by custom integration 'alexa_media' at custom_components/alexa_media/config_flow.py, line 278: self.login = AlexaLogin( (offender: /usr/local/lib/python3.12/ssl.py, line 708: context.load_verify_locations(cafile, capath, cadata)), please create a bug report at https://github.com/alandtse/alexa_media_player/issues
File "/config/custom_components/alexa_media/config_flow.py", line 278, in async_step_user
self.login = AlexaLogin(
2024-09-22 11:17:46.949 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7f4122ddcf50>,) inside the event loop by custom integration 'alexa_media' at custom_components/alexa_media/config_flow.py, line 372: self.proxy = AlexaProxy( (offender: /usr/local/lib/python3.12/site-packages/httpx/_config.py, line 147: context.load_verify_locations(cafile=cafile)), please create a bug report at https://github.com/alandtse/alexa_media_player/issues
File "/config/custom_components/alexa_media/config_flow.py", line 567, in async_step_totp_register
File "/config/custom_components/alexa_media/config_flow.py", line 372, in async_step_start_proxy
self.proxy = AlexaProxy(

Additional context

Logger: homeassistant.setup
Source: setup.py:416
First occurred: 11:30:42 (1 occurrences)
Last logged: 11:30:42

Error during setup of component alexa_media
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 416, in _async_setup_component
result = await task
^^^^^^^^^^
File "/config/custom_components/alexa_media/init.py", line 189, in async_setup
CONF_PUBLIC_URL: account[CONF_PUBLIC_URL],
~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'public_url'

I have successfully installed this at another location - so I am familiar with what is required

@kam0106
Copy link

kam0106 commented Sep 22, 2024

Yes I am getting the same issue. Latest verison of Home Assistant OS with latest version of HACS alexa media player. When I validate the install it redirects me to Amazons website where I sign-in, but won't sign-in and keeps looping on the amazon sign-in page.

@EnricoBettella
Copy link

Yes I am getting the same issue. Latest verison of Home Assistant OS with latest version of HACS alexa media player. When I validate the install it redirects me to Amazons website where I sign-in, but won't sign-in and keeps looping on the amazon sign-in page.

Exactly the same here. With the latest HA Core update and Alexa Media Player it's no longer working due to the login loop on the Amazon page.

@kankadev
Copy link

Same problem. Try to setup this integration for the first time. I login and got redirected to the login page again and again.

@yozh
Copy link

yozh commented Sep 22, 2024

Same issue, older version stopped working, and then went with the latest but get a loop at amz login.

@nstyqz
Copy link

nstyqz commented Sep 22, 2024

Here #2514 there is a halfway solution...

@yozh
Copy link

yozh commented Sep 22, 2024

Here #2514 there is a halfway solution...

Thank you! That worked for me.

@kam0106
Copy link

kam0106 commented Sep 22, 2024

Yep that worked for me. Thanks @nstyqz

@stamandr
Copy link

I can't get by this continuous loop. The work around does not work for me

@kam0106
Copy link

kam0106 commented Sep 23, 2024

Did you use the amazon.com url?
Have you rolled back the AMP plugin version to 4.11.2?
Did you try to create a new account rather than type your username and password on the amazon website?
Also delete your browser history.

@oentzforeva
Copy link

oentzforeva commented Sep 24, 2024

Tried all of the above workaround and also other threads. Nothing works. Always get an empty error message in the end. Log files say:
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.amazonalexa.com:443 ssl:default [Multiple exceptions: [Errno 111] Connect call failed ('0.0.0.0', 443), [Errno 111] Connect call failed ('::', 443, 0, 0)]

Usage via NabuCasa. Tried with and without VPN, other browsers. No changes. Reset to 4.11.2 changed nothing as well

@danielbrunt57
Copy link
Collaborator

Tried all of the above workaround and also other threads. Nothing works. Always get an empty error message in the end. Log files say: aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.amazonalexa.com:443 ssl:default [Multiple exceptions: [Errno 111] Connect call failed ('0.0.0.0', 443), [Errno 111] Connect call failed ('::', 443, 0, 0)]

Usage via NabuCasa. Tried with and without VPN, other browsers. No changes. Reset to 4.11.2 changed nothing as well

For the proxy login process, the Local URL to access Home Assistant is your local Home Assistant URL to process the proxy callback from your local browser with either authentication successful or authentication failed to your local Home Assistant instance which should be http://homeassistant.local:8123. Your local browser acts as the proxy during initial configuration between HA and the Amazon login page. The proxy auth setup has nothing to do with NabuCasa or VPN's...

@oentzforeva
Copy link

Local URL ist set to the local HA IP and Port like http://192.168.1.XXX:8123

@garfield1964
Copy link

garfield1964 commented Sep 25, 2024

Same issue as all above

Tried everything that was given here.

My Versions:

HA
Core 2024.9.3
Supervisor 2024.09.1
Operating System
Frontend 20240909.1

Alexa_Media
v4.13.2

Log is attached:

messages:

2024-09-25 10:42:15.020 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7fff0cc94350>, '/usr/local/lib/python3.12/site-packages/certifi/cacert.pem', None, None) inside the event loop by custom integration 'alexa_media' at custom_components/alexa_media/config_flow.py, line 278: self.login = AlexaLogin( (offender: /usr/local/lib/python3.12/ssl.py, line 708: context.load_verify_locations(cafile, capath, cadata)), please create a bug report at https://github.com/alandtse/alexa_media_player/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_verify_locations
Traceback (most recent call last):

home-assistant_2024-09-25T15-24-35.340Z.log

Thanks for any sollution. Maybe i can get my system running again. I really miss this notify.

@danielbrunt57
Copy link
Collaborator

Same issue as all above

Tried everything that was given here.

My Versions:

HA Core 2024.9.3 Supervisor 2024.09.1 Operating System Frontend 20240909.1

Alexa_Media v4.13.2

Log is attached:

messages:

2024-09-25 10:42:15.020 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7fff0cc94350>, '/usr/local/lib/python3.12/site-packages/certifi/cacert.pem', None, None) inside the event loop by custom integration 'alexa_media' at custom_components/alexa_media/config_flow.py, line 278: self.login = AlexaLogin( (offender: /usr/local/lib/python3.12/ssl.py, line 708: context.load_verify_locations(cafile, capath, cadata)), please create a bug report at https://github.com/alandtse/alexa_media_player/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_verify_locations
Traceback (most recent call last):

home-assistant_2024-09-25T15-24-35.340Z.log

Thanks for any sollution. Maybe i can get my system running again. I really miss this notify.

2024-09-25 10:42:15.020 WARNING has nothing to do with any errors

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Sep 25, 2024

I have encountered several of the errors reported (re-auth, cannot concatenate None type str error, etc.) but was always able to fix as follows...

First, make sure OTP/Amazon 2SV via App is set up correctly and that you have provided the OTP secret to AMP so that it can generate new OTP codes when it needs to reauthenticate with Amazon.
Then, start with a clean slate...
Delete the config entry.
Redownload the AMP custom component in HACS and restart HA.
Check if either of these files exist in /.storage:

cd /config/.storage
ls -al alexa_*
-rw-r--r-- 1 root root 783 Sep 22 16:40 alexa_auth
-rw-r--r-- 1 root root 8480 Sep 22 16:54 alexa_media.<your_email>.pickle

If so, delete them, restart HA and verify they do not exist.
Clear your browser's cookies, restart the browser and then log into Amazon to reestablish its cookies. <- This was critical for me numerous times!
Now login into HA and try re-adding the integration.

@garfield1964
Copy link

Still not working :-(

@cezarq
Copy link

cezarq commented Sep 27, 2024

Same problem!

Logger: homeassistant.util.loop
Source: util/loop.py:136
First occurred: 16:06:35 (2 occurrences)
Last logged: 16:06:47

Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7f73da4fd0>, '/usr/local/lib/python3.12/site-packages/certifi/cacert.pem', None, None) inside the event loop by custom integration 'alexa_media' at custom_components/alexa_media/config_flow.py, line 278: self.login = AlexaLogin( (offender: /usr/local/lib/python3.12/ssl.py, line 708: context.load_verify_locations(cafile, capath, cadata)), please create a bug report at https://github.com/alandtse/alexa_media_player/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_verify_locations Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 189, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 541, in start task = asyncio.Task(coro, loop=loop, eager_start=True) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 462, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 537, in _handle resp = await handler(request) File "/usr/local/lib/python3.12/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 92, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware response = await handler(request) File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle result = await handler(request, **request.match_info) File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin return await func(self, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper return await method(view, request, data, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 366, in async_configure result = await self._async_configure(flow_id, user_input) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 413, in _async_configure result = await self._async_handle_step( File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 516, in _async_handle_step result: _FlowResultT = await getattr(flow, method)(user_input) File "/config/custom_components/alexa_media/config_flow.py", line 278, in async_step_user self.login = AlexaLogin(
Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7f83daac50>,) inside the event loop by custom integration 'alexa_media' at custom_components/alexa_media/config_flow.py, line 372: self.proxy = AlexaProxy( (offender: /usr/local/lib/python3.12/site-packages/httpx/_config.py, line 147: context.load_verify_locations(cafile=cafile)), please create a bug report at https://github.com/alandtse/alexa_media_player/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_verify_locations Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 189, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 541, in start task = asyncio.Task(coro, loop=loop, eager_start=True) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 462, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 537, in _handle resp = await handler(request) File "/usr/local/lib/python3.12/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 92, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware response = await handler(request) File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle result = await handler(request, **request.match_info) File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin return await func(self, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper return await method(view, request, data, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 366, in async_configure result = await self._async_configure(flow_id, user_input) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 413, in _async_configure result = await self._async_handle_step( File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 516, in _async_handle_step result: _FlowResultT = await getattr(flow, method)(user_input) File "/config/custom_components/alexa_media/config_flow.py", line 547, in async_step_proxy_warning return await self.async_step_start_proxy(user_input) File "/config/custom_components/alexa_media/config_flow.py", line 372, in async_step_start_proxy self.proxy = AlexaProxy(

@oentzforeva
Copy link

No solution to this yet? Still empty error message and the configuration is not possible. Tried all variants in this thread, no workaround works.
Since i got Alexa devices especially for notifications from home assistant that might be a dealbreaker in the future. The authentication is always breaking with that integration for the last few months and now its dead for more than a week.
I appreciate the work you guys put in and i know that Amazon is not the easiest provider to work with.

@stamandr
Copy link

I rely on Alexa to give me voice alerts if a water leak sensor detects a water leak. So... for me this is an essential addon, which could potentially save me from extensive damage and huge costs.

I appreciate the hard work put into this and hope the issue can be resolved soon. Everything suggested, does not work reliably for me as well....

@markosiegl
Copy link

I was having the same issue yesterday, and the solution I found was restore a old backup before your update (I used the version 2024.8.2 see picture below), and then it just works (at least for me)

@markosiegl
Copy link

Screenshot 2024-09-29 103457

@garfield1964
Copy link

Hi @markosiegl 👍
Your solution worked for me too. Did also a rollback to core 2024.8.2 and Alexa_media_player did directly do a notify.
Now I will try to do additional updates again.

@z-master42
Copy link
Contributor

After restarting Home Assistant, AMP no longer started.

I found the following error message in the logs:

alexalogin.login((<alexapy.alexalogin.AlexaLogin object at 0x7f4feac8f0>,), {'cookies': {'session-id': <Morsel: session-id=258-6665898-6077905>, 'session-id-time': <Morsel: session-id-time=2082787201l>, 'lc-main': <Morsel: lc-main=de_DE>, 'ubid-main': <Morsel: ubid-main=135-4284205-1578012>, 'session-token': <Morsel: session-token=ekacPPVbh0hCzzm46ai7rvc47qOTP/+JyJK4u81Q+KybVd28XXH4lwVl18Ma3opzqMmI4He7vIbqEuMfa263Clnr0ska1Y1A6dCKSDyWduZC/P89zkjzw6sCtDd3cm4oUI0J045xLwCxQeLTcl7aaf31O4GcrWiDI4wILf4h78jJjol2GY8uwzvy+KzhS6JWmiZrmaWwT7UBzI9QdOoBlXH82rb7JSt27Wngjh62WSMpnkwh7VaiPD1M1Hxfu1ubm9V+v6eTeNRNE4l6fTj7+Qv8i+qklH6tTtlHT+XUGTZVjIi40QkmOjbZpu8DTxW32aAdIJWefGLQ8mv4NPNM+YNNZaLeWqWtjjjPB1EjCKazxOSnpg/XkDymekfdIunI>, 'x-main': <Morsel: x-main=NmtftH3Zke1nH9bnFVI5Ok4HuqkFLD39>, 'at-main': <Morsel: at-main=Atza|IwEBIPPbPfU9xvnQGfE-UqoxgDbAVrAMVrBgeeCcQYqHK3ULwngdtpvJYWglwttZX_9aUyvjY_SnfYOGbNu6FUY2dZa7xkcQo3CMt9niMBf26q-0RTzNS8KutgISXKJ9_VYthnvcfr017Av_gC6zt9NHTFs612ydwZkXXsvZTTxT6K4RnVx0JPHhUT0zGHF_GikMdRpLy90Trx8SWfH68MlZCbdTYizksiBfhHnW2Iw1Mac0KfurjA0JVHXW4Ut9-s0CgQ2fTYXVdit56ovQiAovUPR0BZrVLKvDdkpNRBiLGZFPnQ>, 'sess-at-main': <Morsel: sess-at-main="\"q0BQY+0LxYhsjYuCd0ngQLUf0mUTbSMSf7PH4mCDYqI=\"">, 'ubid-acbde': <Morsel: ubid-acbde=258-0918714-1256756>, 'x-acbde': <Morsel: x-acbde=BJB1f2FjIJpvzPS7dRqTjeie7rqInzP8>, 'at-acbde': <Morsel: at-acbde=Atza|IwEBIL87bYl4QWkJ6qldEKNLAGys3Z1saC1QY6ZzoH_Nq0HZxzcJ8DKY799SvKB9-0e2tet5tj2QcS-TL3HOvUJIfuNCK2XBwiJxCpn7O1B4HcmiubwQIHdWqkaexPPy_--B4ZJGaj2PE_PEe4rt4s3lrBdWetrtIaUXtcyFHPcPQ3bZlJE2cfEH9c4KcxiNBTkFY9OcqJsz8HtyVWjvUCc4jt4-yWimDW0jTERzig5nzPvCtFOUzR0kCa1c-0OPJ0TJg-k__d51fttpLEIH30ITAg3RQIcW1T-51fjpd92F2k4JF58Of7tjDccMZryW0wedlH1ibtzwDGR0ECoWRVI5Dg3pNjvu_FksC__FJLUWtCp3xh_3PfExZnN1b7tJsPRLsOATfoWATA06bpwlaL8gd_5o>, 'sess-at-acbde': <Morsel: sess-at-acbde="d8iQ2wesFvc28VH6HKa+424lKGaGFvx6JeFr2zFJcxA=">, 'csrf': <Morsel: csrf=-1460778058>, 'i18n-prefs': <Morsel: i18n-prefs=EUR>, 'lc-acbde': <Morsel: lc-acbde=de_DE>}}): A connection error occurred: An exception of type ClientConnectorError occurred. Arguments: (ConnectionKey(host='api.amazonalexa.com', port=443, is_ssl=True, ssl=True, proxy=None, proxy_auth=None, proxy_headers_hash=574883396677476861), ConnectionRefusedError(111, "Multiple exceptions: [Errno 111] Connect call failed ('0.0.0.0', 443), [Errno 111] Connect call failed ('::', 443, 0, 0)"))

I then uninstalled AMP and used the workaround from @danielbrunt57 to try a new installation. The workaround works. Only after 2FA and switching to the Home Assistant interface, an empty error message appears and that's it.

I then find the following error in the logs:

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1073, in _wrap_create_connection
    sock = await aiohappyeyeballs.start_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 122, in start_connection
    raise OSError(first_errno, msg)
ConnectionRefusedError: [Errno 111] Multiple exceptions: [Errno 111] Connect call failed ('0.0.0.0', 443), [Errno 111] Connect call failed ('::', 443, 0, 0)

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 462, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 537, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/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 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 215, in get
    return await super().get(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 108, in get
    result = await self._flow_mgr.async_configure(flow_id)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 366, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 413, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 516, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/alexa_media/config_flow.py", line 418, in async_step_finish_proxy
    if await self.login.test_loggedin():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 495, in test_loggedin
    await self.register_capabilities()
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 1131, in register_capabilities
    response = await self._session.put(
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 657, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 564, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 975, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1350, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1319, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1088, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.amazonalexa.com:443 ssl:default [Multiple exceptions: [Errno 111] Connect call failed ('0.0.0.0', 443), [Errno 111] Connect call failed ('::', 443, 0, 0)]

Seems to be the same error as at the beginning and also something to do with aiohttp and the Python version used.

@CommittotheIndian
Copy link

I've wiped everything related to AMP (alexa & .pickle within storage), config, reinstalled to 4.12.11 and I'm on HA 2024.8.2

I can get past the amazon login loop but when I get back to HA, it just presents an error.

image

@linuxstony
Copy link

linuxstony commented Sep 29, 2024

Sadly you are not alone with this i got this empty error as well.

In the logs:

File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1088, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.amazonalexa.com:443 ssl:default [Multiple exceptions: [Errno 111] Connect call failed ('0.0.0.0', 443), [Errno 111] Connect call failed ('::', 443, 0, 0)]

Maybe the API-URL changed?

@z-master42
Copy link
Contributor

I don't think this is a direct AMP problem, but rather one related to alexapy and aiohttp.

According to the Amazon documentation, the end points have not changed.

@Joeslinky
Copy link

Joeslinky commented Sep 30, 2024

Are any of you using an ad blocker/firewall such as Pi-hole or AdGuard by chance? Some adlists were recently updated to block the Amazon Alexa API. This is solved by adding ^api(\.[a-z]+)?\.amazonalexa\.com$ to your Pi-hole whitelist or @@||api*.amazonalexa.com^ for AdGuard. This regex is not region specific and should work for all endpoints. Then use this workaround to get past the login loop.

@Toxo666
Copy link

Toxo666 commented Sep 30, 2024

^^^ This!

In my AdGuard, this url is new on a block list.
i have added @@||api.amazonalexa.com^$important to custom rules an with the 1 page login trick, amp works again.

for now. :)

@linuxstony
Copy link

Are any of you using Pi-Hole by chance? I was able to solve this by adding api.amazonalexa.com to my whitelist.

Yes I do! Why the hell didn't I think if this? Will try asap and report back.....

@sstratoti
Copy link

@Joeslinky THAT DID IT! Thank you!

@linuxstony
Copy link

I feel like such a DAU (dümmster anzunehmender User ) - roughly translated DIU (dumbest imaginable user).....

Pi-hole blocked api.eu.amazonalexa.com and api.amazonalexa.com. After I whitelisted them both it worked.....

THANKS for the nudge into the correct direction!
Works perfectly now.

@z-master42
Copy link
Contributor

Holy shit, how stupid can I be? That's it. Why didn't I think of that myself? 🤦‍♂️

@MikeatLorne
Copy link
Author

MikeatLorne commented Sep 30, 2024 via email

@Joeslinky
Copy link

It wouldn't be in HASS but rather any ad blocker/firewall on your network.

@Suleiman700
Copy link

This may help you

image

@danielbrunt57 danielbrunt57 changed the title not able to install - failing at final step not able to install - failing at final step (KeyError: 'public_url') Nov 11, 2024
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