-
Notifications
You must be signed in to change notification settings - Fork 300
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
"Alexa Media Player failed to login" when adding integration for amazon.co.uk: Not logged in: An exception of type ContentTypeError occurred
#2469
Comments
Could you try this:
|
I have:
I forgot to re-enable debug logging when first trying this, but enabling it afterwards and attempting to add the AMP integration yielded mostly the same I'm not sure if there are more URLs now showing 401 or if I just missed these before. It looks like the same log section so perhaps related to the changes:
From the details of the log message I have managed to reproduce this in RestFox (Postman equivalent). I built up the request from the log message for the request to |
@danielbrunt57 This seems promising so feel free to leave this issue as is for now and I'll keep looking into it when I get chance. Summary below for info and for my own reference. Any guidance is of course welcome. It occurred to me that the login is a proxy, so the cookies would probably be similar to the normal amazon website. I tried https://alexa.amazon.co.uk/api/bootstrap in my browser where I am already logged in and received the correct response. I've then transferred the browser cookies into the RestFox request I had created above, and received the To double check, I returned all of the cookies and it once again returned I logged in to
I have 2 log messages shortly before the failing (formatted for clarity and easier redaction)
There is another log message shortly after this which may (or may not) be related given there are 5 entries in
The code for the log message above looks to be here: https://gitlab.com/keatontaylor/alexapy/-/blob/dev/alexapy/alexalogin.py?ref_type=heads#L1187 This log message seems a little confusing as the code looks to be exchanging a refresh token for cookies, rather than cookies for a refresh token? Between this log message and the failing |
@chrisvblemos Could you step in on this since it appears you have far more knowledge re: cookies, tokens and CSFR (based on alexapy merge request !378) than I do as mine is next to nil... |
I just had this comment on an alexapy merge request (that I cancellled) from alandtse and I think it could very well relate to your issue...
|
amazon.de: As it works for me: Do we use the same minimum aiohttp version? There were cookie fixes: Esp. this for my version 3.10.0:
|
@jleinenbach Are you using I made some adjustments to the logging in I don't have any other version of
The container shows as having restarted based on the uptime, and the changes are still there after reconnect so I'm not sure why they aren't being used. Any ideas? Other things I've tried:
If I can't get the |
|
My |
HA doesn't reinstall packages on restart. Also, making changes directly to the locally stored python packages is not recommended. @deosrc |
Not logged in: An exception of type ContentTypeError occurred
I have the same (?) problems with amazon.de. At least the error messages are looking similar.
tried this already as well. HA 2024.8.2 |
I'm not sure how, but AMP is working again for me. Entity updates, announcements, everything. My container may be in a bit of a mess at the moment. As @chrisvblemos correctly points out, editing packages inside the container is not a good idea.
I believe my active changes are:
There shouldn't be anything in that branch to affect the functionality other than adjusting some logging, but the integration added successfully, and everything seems to be working again. Perhaps it was some of the other recent changes which have now been applied from my steps above. I'll try clean up my container and check to see if it is still working. Additional @chrisvblemos Thanks for the info. It put me on track to learn more about the internals and debugging of HA.
I was still seeing some strange behaviour from the packages. It seems this might not be true: https://developers.home-assistant.io/docs/creating_integration_manifest/#requirements The requirements seems to be checked when adding an integration. At one point when I had an invalid environments setup, attempting to add the AMP integration failed because it couldn't grab the pip package. There may be checks to see if the package is already installed before attempting. I haven't looked into it too closely.
Absolutely. My python knowledge and especially setting up HA container for debugging a pip package is fairly limited. I attempted setting up debugpy after this comment, but the breakpoints weren't being hit. Possibly because they are in a pip module? Even setting I'm aware I'm making a mess of my container at the moment. It will at least destroy any (except within
👍 This seems a much better way, unfortunately see the above about how HA does requirements differently. |
Is there any chance you weren't using the latest alexapy version before using your fork? Not because you did something wrong, but to check if HA is not automatically updating the dependency (I don't think this is the case, but better safe than sorry). Also, could you check if everything works if you roll back alexapy to this change? If you want to keep your way of using branches in the manifest.json, create a new branch and do the rollback. This is to see if any of the latest changes are in fact fixing this issue. |
I'm honestly not sure. The alexa media version in the initial post is definitely accurate (although I've since upgraded to .8) , but I didn't know how to check the alexapy version at the time.
I think I've worked out how the dependencies work now so should be able to target a specific alexapy commit to try this out and report back. Given my deps folder also includes some older versions of python though, I'm thinking it might be worth creating a backup of the folder, and letting HA reacquire the dependencies. I should also look at re-creating the HA container to make sure I'm working with a clean container. |
This is correct. HA will only check component dependencies when adding the integration. HA upgrades will wipe out all custom dependencies, so forcing an add (even if not completed), is the best way to restore dependencies. I believe that was in the wiki at some point (or should be put there). |
Same issue here with amazon.co.uk is there a simple workaround? |
My Alexa Media player has been failing to log in too. I've just tried deleting and re-adding the integration, and even clearing all my 2FA settings, but I still get the 'Alexa Media Player failed to log in' error. I updated to HA 2024.8.3 (I was previously on 8.1) and tried again, but I still can't make it work. Finding this open issue, hopefully this is a general issue with the integration which will be fixed in a future update? Or is this only affecting isolated accounts? |
I'm pretty sure it's affecting thousands!
…On Sun, 1 Sept 2024 at 11:09, David Miller ***@***.***> wrote:
My Alexa Media player has been failing to log in too. I've just tried
deleting and re-adding the integration, and even clearing all my 2FA
settings, but I still get the 'Alexa Media Player failed to log in' error.
I updated to HA 2024.8.3 (I was previously on 8.1) and tried again, but I
still can't make it work.
Finding this open issue, hopefully this is a general issue with the
integration which will be fixed in a future update? Or is this only
affecting isolated accounts?
—
Reply to this email directly, view it on GitHub
<#2469 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABFWRDXL7DFW4LLQ7JKWVLDZULRUHAVCNFSM6AAAAABMWPTCBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRTGI3DQMRZHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Try this:
|
The only thing "sure" (for now) you can do is disable system options, like this: |
I decided that there was nothing more important in the latest HA update
that I needed more than using Alexa Media Player so, as I always keep
backups, I went back to *Core 2024.7.4 *and am waiting for all the mess to
be sorted out! I am also steering clear of Alexa Media Player updates and
am staying with version *4.12.5* for the time being!
It's taking some time to get this sorted out.
…On Mon, 2 Sept 2024 at 13:50, andrea-git ***@***.***> wrote:
I'm pretty sure it's affecting thousands!
… <#m_1798710548594273036_>
On Sun, 1 Sept 2024 at 11:09, David Miller *@*.*> wrote: My Alexa Media
player has been failing to log in too. I've just tried deleting and
re-adding the integration, and even clearing all my 2FA settings, but I
still get the 'Alexa Media Player failed to log in' error. I updated to HA
2024.8.3 (I was previously on 8.1) and tried again, but I still can't make
it work. Finding this open issue, hopefully this is a general issue with
the integration which will be fixed in a future update? Or is this only
affecting isolated accounts? — Reply to this email directly, view it on
GitHub <#2469 (comment)
<#2469 (comment)>>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABFWRDXL7DFW4LLQ7JKWVLDZULRUHAVCNFSM6AAAAABMWPTCBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRTGI3DQMRZHA
<https://github.com/notifications/unsubscribe-auth/ABFWRDXL7DFW4LLQ7JKWVLDZULRUHAVCNFSM6AAAAABMWPTCBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRTGI3DQMRZHA>
. You are receiving this because you are subscribed to this thread.Message
ID: @.*>
The only thing "sure" (for now) you can do is disable system options, like
this:
image.png (view on web)
<https://github.com/user-attachments/assets/3731c259-120d-423a-a76d-36ac421b75b6>
—
Reply to this email directly, view it on GitHub
<#2469 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABFWRDRS6R4ZBJIOMQHHFV3ZURNJBAVCNFSM6AAAAABMWPTCBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRUGY4DMNBUG4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Due to the ongoing issues I encountered after installing Home Assistant 2024.8 and 2024.9, I decided to restore an old backup of version 2024.7.4. |
Any progress or eta regarding this issue? |
I believe that could cause problems inside the code. Two config entries with the same email could be confused. @philtarry A lot of code has changed since August and there is still a pending MR for alexapy: !398 |
It's a while since I've looked at this but I figured that was happening. I was surprised it allowed it and didn't throw errors during the setup, but I guess it's not something you would expect people to do under normal circimstamces. I've been running without issues for a while now and across updates of both HA and AMP, so problem seems to be solved for me. Unfortunately I'm not sure what eventually fixed it. |
Did anyone happen to find a way to resolve this? I know there's been a some updates to the integration since this was reported but I'm still having the issue with a UK based Amazon account. Same as others have mentioned, I can auth to amazon.com fine but obviously don't see any devices from that, amazon.co.uk won't auth at all. |
@electricbears I'm not sure what change it was that fixed it for me but AMP is working fine on my HA with the latest version (and last few versions). If you've not done so already, it might be worth removing the integration entirely, even uninstalling it from HACS, and then re-install and add the integration again. If you still encounter issues, there has been some updates to the logging so if you can turn on debug logging and provide the logs, it might highlight something about your setup (I'd recommend checking the logs for any sensitive data before posting). |
Are you seeing this in debug logs? |
This is still an issue for an Amazon.co.uk account. I’ve deleted the integration and from HACS and started again and while I get a completed successfully message, the integration doesn’t appear.
…On 19 Dec 2024 at 19:55 +0000, Daniel ***@***.***>, wrote:
Are you seeing this in debug logs?
static GET: https://alexa.amazon.de/api/phoenix returned 429:Too Many Requests:application/json
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Need to see debug log trace for |
Can anyone still experiencing this issue provide logs please? Logging has been added/improved since I opened this issue (I made some of the changes myself). Without logs it is almost impossible to help. https://www.home-assistant.io/docs/configuration/troubleshooting/#debug-logs-and-diagnostics If your logs do not specifically have the |
I'd like to add that you should also enable debug logging for |
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
When adding the AMP integration using the
amazon.co.uk
region, login to amazon is successful but then the integration states:To Reproduce
amazon.co.uk
Expected behavior
Should be able to add the integration for the
amazon.co.uk
region.Screenshots
System details
const.py
or HA startup): 4.12.7pip show alexapy
or HA startup): Not sure how to find this in HAOS. Doesn't seem to be in the logs?Logs
Please provide logs.
Apologies if this is excessively redacted.
Additional context
I have found a partial workaround to add the
amazon.co.uk
config entry, but it does not result in a functioning AMP integration. Instead, the integration prompts to be reconfigured (possibly one of the other issues such as #2453), and has some strange behaviour possibly as a result of the same account being registered in two config entries (conflicting pickle file?)The workaround to add the config entry:
amazon.com
region.amazon.co.uk
regionRemove theamazon.com
entry.Edit: Removing the entry seemingly removes both the
amazon.com
andamazon.co.uk
entries. Possibly a conflicting ID (email?) causing some strange behaviour.The text was updated successfully, but these errors were encountered: