Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

# seems to fail more often #31

Closed
4 tasks done
jeffsawatzky opened this issue Feb 4, 2025 · 7 comments
Closed
4 tasks done

# seems to fail more often #31

jeffsawatzky opened this issue Feb 4, 2025 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jeffsawatzky
Copy link
Contributor

Acknowledgements

  • I have written a descriptive issue title
  • I have searched Issues to see if the bug has already been reported
  • I have searched Stack Overflow to ensure the issue I'm experiencing has not already been discussed
  • If possible, I have enabled debug mode and am attaching relevant console logs and HTML files

Operating System

macOS Seqouia 15.3

Python Version

3.11.11

amazon-orders Version

3.2.2

Describe the Bug

When the action for the signin form is https://www.amazon.ca/ap/signin.html it seems to work fine. But lately I've been seeing the action for the form be https://www.amazon.ca/ax/claim/validate, and in these cases the # doesn't work. It also seems to only happen when I use the .ca domain and .com seems to work fine, however I don't have any orders under .com so that doesn't help. Hoping you might know what is going on?

❯ amazon-orders --debug history

=======================================================================
  ___                                   _____         _
 / _ \                                 |  _  |       | |
/ /_\ \_ __ ___   __ _ _______  _ __   | | | |_ __ __| | ___ _ __ ___
|  _  | '_ ` _ \ / _` |_  / _ \| '_ \  | | | | '__/ _` |/ _ \ '__/ __|
| | | | | | | | | (_| |/ / (_) | | | | \ \_/ / | | (_| |  __/ |  \__ \\
\_| |_/_| |_| |_|\__,_/___\___/|_| |_|  \___/|_|  \__,_|\___|_|  |___/
=======================================================================
                                                               v3.2.2

GET request to https://www.amazon.ca/gp/sign-in.html
Response: https://www.amazon.ca/ap/signin?openid.pape.max_auth_age=900&openid.return_to=https%3A%2F%2Fwww.amazon.ca%3F&openid.assoc_handle=caflex&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0 - 200
Response written to file: /Users/me/Code/private/amazon-orders/output/signin_0.html
POST request to https://www.amazon.ca/ax/claim/validate?openid.mode=checkid_setup&policy_handle=Retail-Checkout&openid.return_to=https%3A%2F%2Fwww.amazon.ca%3F&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&arb=cf2caf0b-8a2a-40ea-a25c-52c71163f34b&openid.assoc_handle=caflex
Response: https://www.amazon.ca/ax/claim/validate?openid.mode=checkid_setup&policy_handle=Retail-Checkout&openid.return_to=https%3A%2F%2Fwww.amazon.ca%3F&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&arb=cf2caf0b-8a2a-40ea-a25c-52c71163f34b&openid.assoc_handle=caflex - 400
Response written to file: /Users/me/Code/private/amazon-orders/output/validate_0.html
Info: Authenticating 'me@example.com' failed, retrying ...

Password: 

GET request to https://www.amazon.ca/gp/sign-in.html
Response: https://www.amazon.ca/ap/signin?openid.pape.max_auth_age=900&openid.return_to=https%3A%2F%2Fwww.amazon.ca%3F&openid.assoc_handle=caflex&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0 - 200
Response written to file: /Users/me/Code/private/amazon-orders/output/signin_1.html
POST request to https://www.amazon.ca/ax/claim/validate?policy_handle=Retail-Checkout&openid.return_to=https%3A%2F%2Fwww.amazon.ca%3F&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&arb=af4a1a14-517a-40ab-bd5d-2fdcaf8d9312&openid.assoc_handle=caflex&openid.mode=checkid_setup
Response: https://www.amazon.ca/ax/claim/validate?policy_handle=Retail-Checkout&openid.return_to=https%3A%2F%2Fwww.amazon.ca%3F&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&arb=af4a1a14-517a-40ab-bd5d-2fdcaf8d9312&openid.assoc_handle=caflex&openid.mode=checkid_setup - 400
Response written to file: /Users/me/Code/private/amazon-orders/output/validate_1.html
An error occurred.
Traceback (most recent call last):
  File "/Users/me/Code/private/amazon-orders/venv/lib/python3.11/site-packages/amazonorders/cli.py", line 316, in _authenticate
    amazon_session.login()
  File "/Users/me/Code/private/amazon-orders/venv/lib/python3.11/site-packages/amazonorders/session.py", line 253, in login
    self._raise_auth_error()
  File "/Users/me/Code/private/amazon-orders/venv/lib/python3.11/site-packages/amazonorders/session.py", line 319, in _raise_auth_error
    raise AmazonOrdersAuthError(error_msg)
amazonorders.exception.AmazonOrdersAuthError: An error occurred, the page https://www.amazon.ca/ax/claim/validate?openid.mode=checkid_setup&policy_handle=Retail-Checkout&openid.return_to=https%3A%2F%2Fwww.amazon.ca%3F&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&arb=cf2caf0b-8a2a-40ea-a25c-52c71163f34b&openid.assoc_handle=caflex returned 400.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/me/Code/private/amazon-orders/venv/lib/python3.11/site-packages/amazonorders/cli.py", line 129, in history
    _authenticate(amazon_session)
  File "/Users/me/Code/private/amazon-orders/venv/lib/python3.11/site-packages/amazonorders/cli.py", line 326, in _authenticate
    _authenticate(amazon_session, retries=retries + 1)
  File "/Users/me/Code/private/amazon-orders/venv/lib/python3.11/site-packages/amazonorders/cli.py", line 328, in _authenticate
    raise e
  File "/Users/me/Code/private/amazon-orders/venv/lib/python3.11/site-packages/amazonorders/cli.py", line 316, in _authenticate
    amazon_session.login()
  File "/Users/me/Code/private/amazon-orders/venv/lib/python3.11/site-packages/amazonorders/session.py", line 253, in login
    self._raise_auth_error()
  File "/Users/me/Code/private/amazon-orders/venv/lib/python3.11/site-packages/amazonorders/session.py", line 319, in _raise_auth_error
    raise AmazonOrdersAuthError(error_msg)
amazonorders.exception.AmazonOrdersAuthError: An error occurred, the page https://www.amazon.ca/ax/claim/validate?policy_handle=Retail-Checkout&openid.return_to=https%3A%2F%2Fwww.amazon.ca%3F&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&arb=af4a1a14-517a-40ab-bd5d-2fdcaf8d9312&openid.assoc_handle=caflex&openid.mode=checkid_setup returned 400.
Usage: amazon-orders history [OPTIONS]
Try 'amazon-orders history --help' for help.

Error: An error occurred, the page https://www.amazon.ca/ax/claim/validate?policy_handle=Retail-Checkout&openid.return_to=https%3A%2F%2Fwww.amazon.ca%3F&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&arb=af4a1a14-517a-40ab-bd5d-2fdcaf8d9312&openid.assoc_handle=caflex&openid.mode=checkid_setup returned 400.

Steps to Reproduce

  1. Use the amazon.ca host
  2. Try to log in
  3. Sometimes I get the error above.

Expected Behavior

# to work

@jeffsawatzky jeffsawatzky added the bug Something isn't working label Feb 4, 2025
@alexdlaird
Copy link
Owner

alexdlaird commented Feb 4, 2025

There is no support for non-English, non .com sites as of yet, as mentioned in #15.

@alexdlaird alexdlaird added duplicate This issue or pull request already exists and removed bug Something isn't working labels Feb 4, 2025
@jeffsawatzky
Copy link
Contributor Author

@alexdlaird I understand the non-english thing, but .ca is english. And it _was_working, and does sometimes...was hoping you might have come across why it doesn't work sometimes.

@alexdlaird
Copy link
Owner

Understood. What I'm clarying is, any support for non-English and/or other top-level domains was a coincidence, not officially supported. From an infrastructure perspective, Amazon's .ca site is going to be a separate entity from its .com. So therefore it would need an entire effort around ensuring it is actually supported, the regression sets would need to be been run against it, etc. None of this has been done, so anything that has worked in the past was a happy accident.

I don't have the means myself to support any non-English, non .com version of the site. So if and when official support for any of those might be added in to the library (and how we can confidently do that) remains an open question that would need a lot of evaluation, I think.

@jeffsawatzky
Copy link
Contributor Author

@alexdlaird It seems to be an issue with a new form. I'm not sure if it is specific to .ca or if it could appear for .com at some point as well. I was under the impression that all domains shared basic code and functionality, and the pages were just localized (and different products per domain).

The new sign-in flow seems to have a new SIGNIN_CLAIM_COLLECT step, and this step seems to have a dynamically generated metadata form input that changes every second through javascript, and it seems that without this the form post will fail.

Another weird thing that I noticed, is it seems to only appear during the first attempt to sign-in. For instance, if I do the following:

amazon-orders logout
amazon-orders history

It will fail to #, ask for my password again, and fail a second time, and then exit. And then if I rerun

amazon-orders history

It will then work...so it seems like something with cookies might be affecting which sign-in flow is being presented?

@alexdlaird
Copy link
Owner

Fantastic finding, I will reopen this, as I've seen it several times before, and that seems like a very real possibility (that they're A/B testing a new auth form). I have not yet seen this form, so if you could run with --debug mode and attach and output it spits out for what that page (or the cookies surrounding it) might look like, that'd be super useful! Or if you find a solution, whether it's something we can bake back in the library or is just a one-off solution for you, do please share it here for others too!

@alexdlaird alexdlaird reopened this Feb 4, 2025
@alexdlaird alexdlaird added enhancement New feature or request and removed duplicate This issue or pull request already exists labels Feb 4, 2025
Copy link

This issue is stale because it has remained open with no further activity on it. Comment with additional context or the issue will be closed automatically. Thank you for your contribution!

@github-actions github-actions bot added the stale Issue will be closed automatically if no further activity occurs label Feb 12, 2025
@alexdlaird alexdlaird added more-info-needed More information is required to be able to troubleshoot this issue and removed stale Issue will be closed automatically if no further activity occurs labels Feb 12, 2025
Repository owner deleted a comment from github-actions bot Feb 12, 2025
@alexdlaird alexdlaird added ready Issue has been triaged and accepted, ready to work wip Work in progress, will be ignored by stale bot and removed more-info-needed More information is required to be able to troubleshoot this issue ready Issue has been triaged and accepted, ready to work labels Feb 12, 2025
@alexdlaird alexdlaird added valid help wanted Extra attention is needed and removed wip Work in progress, will be ignored by stale bot valid labels Feb 23, 2025
@alexdlaird
Copy link
Owner

Without more specific detail, I'm going to close this ticket. Feel free to re-open once there's a specific use-case capture that we can debug.

I do wonder if it's related to Captcha though (see #45).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants