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

Can't add integration (Config flow could not be loaded: {"message":"Invalid handler specified"}) #2293

Closed
nilsburg opened this issue Jun 29, 2024 · 93 comments

Comments

@nilsburg
Copy link

When trying to add the integration a popup shows with the following message:

Config flow could not be loaded: {"message":"Invalid handler specified"}

It was working but it stopped working since upgrading HA to 2024.6.3 (I think because of #2288) and wasn't able to reload (there was no reload option).
I decided to remove the integration, remove the component from HACS and start fresh, but after adding the component with HACS and trying to add the integration I get the error.

  1. Go to 'Settings > Devices & services'
  2. Click on 'Add integration > Alexa Media Player'
  3. See error

System details

  • Home-assistant (version): Core 2024.6.5, OS 12.4
  • alexa_media (version from const.py or HA startup): 4.10.2
  • alexapy (version from pip show alexapy or HA startup): for some reason can't figure out, pip show alexapy returns Package(s) not found: alexapy
  • Amazon 2FA is enabled (y/n). : yes

Logs

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1249, in _load_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1281, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 131, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/alexa_media/__init__.py", line 16, in <module>
    from alexapy import (
  File "/usr/local/lib/python3.12/site-packages/alexapy/__init__.py", line 41, in <module>
    __maintainer__ = metadata["maintainer"]
                     ~~~~~~~~^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/importlib_metadata/_adapters.py", line 54, in __getitem__
    raise KeyError(item)
KeyError: 'maintainer'
2024-06-29 08:33:26.214 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to import_module inside the event loop by integration 'config' at homeassistant/components/config/config_entries.py, line 179: return await super()._post_impl(request, data) (offender: /usr/src/homeassistant/homeassistant/loader.py, line 1281: return importlib.import_module(f"{self.pkg_path}.{platform_name}")), please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+config%22
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
    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 190, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 672, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, 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 452, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, 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/http/data_validator.py", line 70, in wrapper
    return await method(view, request, data, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 172, in post
    return await self._post_impl(request, data)
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 179, in _post_impl
    return await super()._post_impl(request, data)

2024-06-29 08:33:26.216 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform custom_components.alexa_media.config_flow
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1249, in _load_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1281, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 131, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/alexa_media/__init__.py", line 16, in <module>
    from alexapy import (
  File "/usr/local/lib/python3.12/site-packages/alexapy/__init__.py", line 41, in <module>
    __maintainer__ = metadata["maintainer"]
                     ~~~~~~~~^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/importlib_metadata/_adapters.py", line 54, in __getitem__
    raise KeyError(item)
KeyError: 'maintainer'
2024-06-29 08:33:26.217 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration alexa_media: Exception importing custom_components.alexa_media.config_flow
@asiersan
Copy link

asiersan commented Jul 4, 2024

same here

@gittiralf
Copy link

I have the same problem after updating homeassistant to release 2024.7

@Fr3i4
Copy link

Fr3i4 commented Jul 5, 2024

I have the same issue and try the same procedure to fix it, even the same logs and results....

@jondiez
Copy link

jondiez commented Jul 6, 2024

Same problem with Ha 2024.7.1 and alexa Media player 4.10.3.
I have it configured but it does not load when HA starts

@jalbertseg
Copy link

Here too

1 similar comment
@jmservianri
Copy link

Here too

@jalbertseg
Copy link

With 2024.7.1 it was resolved!

@jmservianri
Copy link

No differences with 2024.7.1, i have the same problem.

@jondiez
Copy link

jondiez commented Jul 7, 2024

Registrador: homeassistant.setup
Fuente: setup.py:322
Ocurrió por primera vez: 15:35:27 (1 ocurrencias)
Último inicio de sesión: 15:35:27

Setup failed for custom integration 'alexa_media': Unable to import component: Exception importing custom_components.alexa_media
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1050, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/config/custom_components/alexa_media/init.py", line 16, in
from alexapy import (
File "/usr/local/lib/python3.12/site-packages/alexapy/init.py", line 41, in
maintainer = metadata["maintainer"]
~~~~~~~~^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/importlib_metadata/_adapters.py", line 54, in getitem
raise KeyError(item)
KeyError: 'maintainer'

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

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 990, in async_get_component
comp = await self.hass.async_add_import_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1061, in _get_component
raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing custom_components.alexa_media

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1050, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/config/custom_components/alexa_media/init.py", line 16, in
from alexapy import (
File "/usr/local/lib/python3.12/site-packages/alexapy/init.py", line 41, in
maintainer = metadata["maintainer"]
~~~~~~~~^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/importlib_metadata/_adapters.py", line 54, in getitem
raise KeyError(item)
KeyError: 'maintainer'

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

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 322, in _async_setup_component
component = await integration.async_get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1010, in async_get_component
self._component_future.result()
File "/usr/src/homeassistant/homeassistant/loader.py", line 1002, in async_get_component
comp = self._get_component()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1061, in _get_component
raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing custom_components.alexa_media

@gittiralf
Copy link

I could solve the problem by recreate my homeassistant docker container. Nothing else did it.
Perhaps this tipp helps someone...

@jcss2503
Copy link

jcss2503 commented Jul 8, 2024

Same problem here! HA 2024.71

@wischi83
Copy link

wischi83 commented Jul 8, 2024

Same problem here! HA 2024.7.1

2 similar comments
@jorgbad
Copy link

jorgbad commented Jul 8, 2024

Same problem here! HA 2024.7.1

@drufoval
Copy link

Same problem here! HA 2024.7.1

@casa3c
Copy link

casa3c commented Jul 10, 2024

Same here:

Registrador: homeassistant.setup
Fuente: setup.py:322
Ocurrió por primera vez: 16:51:13 (1 ocurrencias)
Último inicio de sesión: 16:51:13

Setup failed for custom integration 'alexa_media': Unable to import component: Exception importing custom_components.alexa_media
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/config/custom_components/alexa_media/init.py", line 16, in
from alexapy import (
File "/usr/local/lib/python3.12/site-packages/alexapy/init.py", line 41, in
maintainer = metadata["maintainer"]
~~~~~~~~^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/importlib_metadata/_adapters.py", line 54, in getitem
raise KeyError(item)
KeyError: 'maintainer'

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

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1007, in async_get_component
comp = await self.hass.async_add_import_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1078, in _get_component
raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing custom_components.alexa_media

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/config/custom_components/alexa_media/init.py", line 16, in
from alexapy import (
File "/usr/local/lib/python3.12/site-packages/alexapy/init.py", line 41, in
maintainer = metadata["maintainer"]
~~~~~~~~^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/importlib_metadata/_adapters.py", line 54, in getitem
raise KeyError(item)
KeyError: 'maintainer'

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

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 322, in _async_setup_component
component = await integration.async_get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1027, in async_get_component
self._component_future.result()
File "/usr/src/homeassistant/homeassistant/loader.py", line 1019, in async_get_component
comp = self._get_component()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1078, in _get_component
raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing custom_components.alexa_media

@jcss2503
Copy link

jcss2503 commented Jul 10, 2024 via email

@nstyqz
Copy link

nstyqz commented Jul 10, 2024

Confirmed HA 2024.7.2 still problem.
Edit: I managed to make it work by installing HA 2024.7.0 from the terminal but after updating, the issue persists... 😵‍💫😵‍💫😵‍💫

@drufoval
Copy link

After the upgrade to 2024.7.2 for me resolve the issue...

@st3v3nFr
Copy link

Same here. everything was working until i update to 2024.7.2 ( i was on 2024.6 before that)

@czebulski
Copy link

Same here on 2024.7.x

@Gallach
Copy link

Gallach commented Jul 12, 2024

I'm also facing the same issue with same versions:

Home-assistant (version): 2024.7.2
alexa_media (version): v4.10.3

@casa3c
Copy link

casa3c commented Jul 12, 2024

Developers, any update???

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Jul 12, 2024

This is bizarre.
I'm now on 2024.7.2 and have done each and every HA as they come out so I've progressed through them all.
2024.6.3 created a partitioned cookie error on AMP init after HA restart vut after HA started you could reload the integration and it's then fine. I've worked on that cookie issue and for some reason, since 2024.6.3 it's partitioned at initial init but not after HA is fully started. There's a PR for python 3.13b3 to add partitioned cookie support but we won't see 3.13 final until approx. October and HA will hopefully implement it not too long after that, beta first of course. For for non-beta versions I doubt we'll see it until 2024.12.0 (or later).

I've been working on recoding the integration to expand the CONFIGURE options since just before 2024.7 came out and as such I've completely re & re'd the integration many times , including removing it from HACS (no, I do not run a development system for testing). alexapy only gets removed when AMP is removed in HACS, plus two restarts are/were necessary before the integration could be added successfully. The first restart executes the AMP code from this github repository which retrieves the alexapy module that is added to HA so a 2nd restart is required to execute the alexapy code which is located in /usr/local/lib/python3.12/site-packages/.

I've not seen this error in any of my restarts but then again, my recent scenario is much different than any of you.
Bottom line, has anyone tried a complete re & re (integration & package) or at least a package redownload in HACS to see if that solves it?

@st3v3nFr
Copy link

I tried to re download alexa_media from Hacs without any success

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Jul 12, 2024

Ok, let me try the original integration again as I've not tried it since ???

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Jul 12, 2024

I saved my work, deleted the integration, redownloaded the HACS package, restarted HA and installed the integration and it works fine. I restarted HA a 2nd time and still fine.

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Jul 12, 2024

I'm still using the python 3.13beta3 cookies.py file from PR gh-112713 though but that should be irrelevant to this issue..

@st3v3nFr
Copy link

I made a backup, uninstall, reboot, install again, restarted again, reboot a second time, and no luck, still stuck with :
Le flux de configuration n'a pas pu être chargé: {"message":"Invalid handler specified"}

@st3v3nFr
Copy link

i also tried to remove HACS and reinstall, then install alexa_media_player but no luck

@nstyqz
Copy link

nstyqz commented Jul 16, 2024

Resolved, you were right, reinstalled, and it works now. Thanks a lot

@danielbrunt57
Copy link
Collaborator

Once my config enhancement PR is finalized, i can issue a new PR to incorporate the new manifest.json...

@st3v3nFr
Copy link

I've published v4.10.3.1 with the "importlib-metadata==6.8.0" requirement.

Hi Daniel and thank you for your help :)
Please be aware that adding a 'importlib-metadata==6.8.0' is temporary fix, and may either not work later or cause issues, depends on what other lin HA will be using in a further update !

@st3v3nFr
Copy link

@nstyqz : Thank you! That error is the subject of this issue. I've published v4.10.3.1 with the modified manifest.json. Give that a whirl and see what happens!

File "/usr/local/lib/python3.12/site-packages/alexapy/init.py", line 41, in
maintainer = metadata["maintainer"]

I've alerted Alan to this issue but he has no idea where the problem is coming from. I am running 4.3.10.1 (even though I did not need it) with no ill effects that I can see...

IT might be related to HA version, may be in a further update, we could simply be ok !

@danielbrunt57
Copy link
Collaborator

IT might be related to HA version, may be in a further update, we could simply be ok !

I highly doubt that it's related to the HA Core code as I think Core is basically platform independent. But perhaps it's some python module(s) it's driven by as those I think are compiled for different platforms. That or possibly another integration that some folks have that I and others without the problem do not...

@st3v3nFr
Copy link

LAst Alexa update fix all issues !
th you !!

@danielbrunt57
Copy link
Collaborator

LAst Alexa update fix all issues !

Is that the official v4.11.0 with this manifest.json?

{
  "domain": "alexa_media",
  "name": "Alexa Media Player",
  "codeowners": ["@alandtse", "@keatontaylor"],
  "config_flow": true,
  "dependencies": ["persistent_notification", "http"],
  "documentation": "https://github.com/alandtse/alexa_media_player/wiki",
  "iot_class": "cloud_polling",
  "issue_tracker": "https://github.com/alandtse/alexa_media_player/issues",
  "loggers": ["alexapy", "authcaptureproxy"],
  "requirements": ["alexapy==1.27.10", "packaging>=20.3", "wrapt>=1.14.0"],
  "version": "4.11.0"
}

@st3v3nFr
Copy link

LAst Alexa update fix all issues !

Is that the official v4.11.0 with this manifest.json?

{
  "domain": "alexa_media",
  "name": "Alexa Media Player",
  "codeowners": ["@alandtse", "@keatontaylor"],
  "config_flow": true,
  "dependencies": ["persistent_notification", "http"],
  "documentation": "https://github.com/alandtse/alexa_media_player/wiki",
  "iot_class": "cloud_polling",
  "issue_tracker": "https://github.com/alandtse/alexa_media_player/issues",
  "loggers": ["alexapy", "authcaptureproxy"],
  "requirements": ["alexapy==1.27.10", "packaging>=20.3", "wrapt>=1.14.0"],
  "version": "4.11.0"
}

Yep !
here is mine in 4.11.0

{
"domain": "alexa_media",
"name": "Alexa Media Player",
"codeowners": ["@alandtse", "@keatontaylor"],
"config_flow": true,
"dependencies": ["persistent_notification", "http"],
"documentation": "https://github.com/alandtse/alexa_media_player/wiki",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/alandtse/alexa_media_player/issues",
"loggers": ["alexapy", "authcaptureproxy"],
"requirements": ["alexapy==1.27.10", "packaging>=20.3", "wrapt>=1.14.0"],
"version": "4.11.0"
}

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Jul 18, 2024

This is now very weird! @st3v3nFr is fine now.
@edudele, can you try this. It's a stab in the dark and a bit lengthy but...

  • Remove Alexa Media Player integration in HA.
  • Restart.
  • Remove Alexa Media Player in HACS and any Alexa Media Player custom repositories.
  • Restart.
  • Delete pickle file: /config/.storage/alexa_media.<your_email>.pickle
  • Verify alexapy folder has been removed from /usr/local/lib/python3.12/site-packages in home assistant container.
  • Remove HACS integration in HA; restart if prompted.
  • Reinstall HACS; restart if prompted.
  • Install any other HA or HACS updates.
  • Download Alexa Media Player in HACS.
  • Restart twice.
  • Install Alexa Media Player integration in HA.

Like I said, a lot of steps but just trying to be thorough...

@nstyqz
Copy link

nstyqz commented Jul 18, 2024

At that time, deleting the file alexa media.pickle helped me

@st3v3nFr
Copy link

@edudele
what if you edit /config/custom_components/alexa_media/manifest.jsonand add :

, "importlib-metadata==6.8.0"

to this line ? :
"requirements": ["alexapy==1.27.10", "packaging>=20.3", "wrapt>=1.14.0"],

so it would be like this :
"requirements": ["alexapy==1.27.10", "packaging>=20.3", "wrapt>=1.14.0", "importlib-metadata==6.8.0"],

@st3v3nFr
Copy link

OK , what if you try to insert the same line but after downgrtading alexa plugin to prior version ?

@danielbrunt57
Copy link
Collaborator

What does your current http block in configuration.yaml look like?

image

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Jul 19, 2024

I think you have an HA proxy issue rather than an Alexa Media Player issue as the https://........./auth/.... is failing to gain access.
Are you able to access https://......../ (your external URL) from outside your network??
Do you have any other integrations which need cloud authorization callbacks to function?

@nstyqz
Copy link

nstyqz commented Jul 19, 2024

It helped me at the time to create the section my:

Add the following section to your configuration.yaml file:

# Example configuration.yaml entry
my:

@danielbrunt57
Copy link
Collaborator

Yes, of course I have full access via HTTPS, but I think the problem lies with Cloudflare.

I also use cloudflare and agree it should be transparent but cloudflare is a complicated beast and only recently started thinking it was a factor in all of this. I think it might be the culprit with the partitioned cookie error that some people have (myself included) but a lot don't. Hours ago I bit the bullet and resubscribed to Nabu Casa and all of my problems went away. It was to assist in issue 2318 but that one appears to be an issue with his Amazon account and is unreated to this issue. Nevertheless, it did prove to be that Cloudflare is at play here...

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Jul 19, 2024

It helped me at the time to create the section my:

I've been using my: for a long time:
(I'm specifying the components I want included rather than default config - primarily to disable/enable cloud)

image

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Jul 19, 2024

You can add my: anywhere after default_config:. I like to keep mine in alphabetical order!

That may or may not help. I only think it's used when you encounter those links in integration descriptions where they have a button you can click to automatically link you to the setup in HA.

In my Cloudflare I have this which I think I added to bypass other lockdowns I have and permit direct /auth callbacks though by Cloudflare tunnel....

image

@danielbrunt57
Copy link
Collaborator

I have the lambda created in AWS, with everything working correctly. The client_id and the client_secret.

The AWS lambda does not have to use a /auth callback for authentication like AMP does. That process initiates the login session to HA from Amazon. This initiates an auth callback from inside HA for authorization and that is used in HA to log into Amazon. They are the opposite of each other.

@danielbrunt57
Copy link
Collaborator

Is that part still not working? Or is it the legacy mode that it says in the integration configuration? How do I enable it, to use the old method?

That part of the integration I've not been able to figure out/totally understand. It's been 3 or more years since I used legacy setup. I know the code for it is still in config_flow.py. I think all you do to disable the "use proxy login method" is not provide the external URL for proxy callback. but like I said, I'm not sure.

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Jul 19, 2024

So, I just finished re-activating my pfSense NAT & firewall rule that permits direct login from AWS servers, re-added my DDNS update for a different subdomain URL which bypasses Cloudflare proxy, remove AMP integration, restarted, removed AMP in HACS, restarted, deleted /usr/local/lib/python3.12/site-packages/alexa* (two were still present), restarted, added AMP in HACS, restarted twice, added AMP integration to HA and it configured just fine. Restarted and all is still fine.

  • No auth callback troubles
  • No metadata problems
  • No partitioned cookie error

All of these problems seem to arise when Cloudflare is added into the mix.

@danielbrunt57
Copy link
Collaborator

And just remember that I am just an average user like yourself but with a 35+ professional background in programming and IT support and only 4 years using Home Assistant and 2 years doing my best to give back to the community. Also just remember that your issue stems from the fact that your cloudflare appears to not be configured properly to pass auth callbacks and any integration you install that uses auth callback for cloud authentication will also fail. This is not Alexa Media Player's fault and it reared its ugly head with suspected HA internal structure & processing changes from 2024.6.2 to 2024.6.3. If you still feel the same as you did 8 hours ago then I'm sorry I wasted so much of my valuable time on this issue.

@danielbrunt57
Copy link
Collaborator

@alandtse Please close this.
Thanks.

@st3v3nFr
Copy link

@danielbrunt57
Hi Daniel !

Just updated HA and last Alxea component today, and got backk to the previous error, with being unable to load the component.
If you have any clues ??

@danielbrunt57
Copy link
Collaborator

Just updated HA and last Alxea component today, and got backk to the previous error, with being unable to load the component. If you have any clues ??

Looks like this a duplicate post??

@danielbrunt57
Copy link
Collaborator

manifest.json:

"requirements": ["alexapy==1.27.10", "packaging>=20.3", "wrapt>=1.14.0", "importlib-metadata==6.8.0"], "

@nstyqz
Copy link

nstyqz commented Jul 21, 2024

After the latest update v4.11.4, have returned to alandtse repository, and everything is correct in Home Assistant Green core 2024.7.2
Thank you very much for all the work 🖖 @danielbrunt57

P.S.: It is a true pleasure to encounter such kind and dedicated people in the community. I am very proud and hope that, at the very least, this makes the work worthwhile. Regards.

@danielbrunt57
Copy link
Collaborator

P.S.: It is a true pleasure to encounter such kind and dedicated people in the community. I am very proud and hope that, at the very least, this makes the work worthwhile. Regards.

Yes, it does indeed! Thank you! 🙏

@nstyqz
Copy link

nstyqz commented Aug 5, 2024

😎 I'm back...

Registrador: homeassistant.loader
Fuente: loader.py:1264

Unexpected exception importing platform custom_components.alexa_media.config_flow

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1264, in _load_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1296, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1310, in _find_and_load_unlocked
File "", line 488, in _call_with_frames_removed
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/config/custom_components/alexa_media/init.py", line 17, in
from alexapy import (
File "/usr/local/lib/python3.12/site-packages/alexapy/init.py", line 41, in
maintainer = metadata["maintainer"]
~~~~~~~~^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/importlib_metadata/_adapters.py", line 54, in getitem
raise KeyError(item)
KeyError: 'maintainer'

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