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

Error: Authentication Failure [TimeoutException] Message #133

Open
augieschwer opened this issue Feb 17, 2025 · 6 comments · May be fixed by #134
Open

Error: Authentication Failure [TimeoutException] Message #133

augieschwer opened this issue Feb 17, 2025 · 6 comments · May be fixed by #134

Comments

@augieschwer
Copy link

Is this what it looks like when the WAF blocks you?

docker build -t localsafeway:latest https://github.com/smkent/safeway-coupons.git#main
...
docker run localsafeway
docker exec -it beautiful_haslett /bin/bash
safeway-coupons --dry-run --no-email --debug
Clipping coupons for Safeway account *****
Connect to safeway.com
Decline cookie prompt
Return to safeway.com after declining cookie prompt
Open Sign In sidebar
Would send email to *****
>>>>>>
Safeway account: *****
Error: Authentication Failure ([TimeoutException] Message: 
Stacktrace:
#0 0x55895b7a6bba <unknown>
#1 0x55895b244790 <unknown>
#2 0x55895b295c80 <unknown>
#3 0x55895b295e01 <unknown>
#4 0x55895b2e4944 <unknown>
#5 0x55895b2bba7d <unknown>
#6 0x55895b2e1ccc <unknown>
#7 0x55895b2bb823 <unknown>
#8 0x55895b287a88 <unknown>
#9 0x55895b288bf1 <unknown>
#10 0x55895b77015b <unknown>
#11 0x55895b7740e2 <unknown>
#12 0x55895b75d01c <unknown>
#13 0x55895b774cd4 <unknown>
#14 0x55895b74148f <unknown>
#15 0x55895b7954f8 <unknown>
#16 0x55895b7956c9 <unknown>
#17 0x55895b7a5a36 <unknown>
#18 0x7ff1fe43a1c4 <unknown>
)
<<<<<<
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 71, in _chrome_driver
    yield driver
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 118, in _login
    wait.until(
    ~~~~~~~~~~^
        ec.visibility_of_element_located(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            (By.XPATH, "//span [contains(text(), 'Sign In')]")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        )
        ^
    ).click()
    ^
  File "/usr/local/lib/python3.13/site-packages/selenium/webdriver/support/wait.py", line 146, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: 
Stacktrace:
#0 0x55895b7a6bba <unknown>
#1 0x55895b244790 <unknown>
#2 0x55895b295c80 <unknown>
#3 0x55895b295e01 <unknown>
#4 0x55895b2e4944 <unknown>
#5 0x55895b2bba7d <unknown>
#6 0x55895b2e1ccc <unknown>
#7 0x55895b2bb823 <unknown>
#8 0x55895b287a88 <unknown>
#9 0x55895b288bf1 <unknown>
#10 0x55895b77015b <unknown>
#11 0x55895b7740e2 <unknown>
#12 0x55895b75d01c <unknown>
#13 0x55895b774cd4 <unknown>
#14 0x55895b74148f <unknown>
#15 0x55895b7954f8 <unknown>
#16 0x55895b7956c9 <unknown>
#17 0x55895b7a5a36 <unknown>
#18 0x7ff1fe43a1c4 <unknown>


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

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 59, in __init__
    self._login(account)
    ~~~~~~~~~~~^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 96, in _login
    with self._chrome_driver() as driver:
         ~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/contextlib.py", line 162, in __exit__
    self.gen.throw(value)
    ~~~~~~~~~~~~~~^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 79, in _chrome_driver
    raise ExceptionWithAttachments(
        f"[{type(e).__name__}] {e}", attachments=attachments
    ) from e
safeway_coupons.session.ExceptionWithAttachments: [TimeoutException] Message: 
Stacktrace:
#0 0x55895b7a6bba <unknown>
#1 0x55895b244790 <unknown>
#2 0x55895b295c80 <unknown>
#3 0x55895b295e01 <unknown>
#4 0x55895b2e4944 <unknown>
#5 0x55895b2bba7d <unknown>
#6 0x55895b2e1ccc <unknown>
#7 0x55895b2bb823 <unknown>
#8 0x55895b287a88 <unknown>
#9 0x55895b288bf1 <unknown>
#10 0x55895b77015b <unknown>
#11 0x55895b7740e2 <unknown>
#12 0x55895b75d01c <unknown>
#13 0x55895b774cd4 <unknown>
#14 0x55895b74148f <unknown>
#15 0x55895b7954f8 <unknown>
#16 0x55895b7956c9 <unknown>
#17 0x55895b7a5a36 <unknown>
#18 0x7ff1fe43a1c4 <unknown>


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

Traceback (most recent call last):
  File "/usr/local/bin/safeway-coupons", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/app.py", line 125, in main
    sc.clip_for_account(account)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/safeway.py", line 38, in clip_for_account
    swy = SafewayClient(account, self.debug_dir)
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/client.py", line 17, in __init__
    self.session = LoginSession(account, debug_dir)
                   ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 61, in __init__
    raise AuthenticationFailure(
        e, account, attachments=e.attachments
    ) from e
safeway_coupons.errors.AuthenticationFailure: Authentication Failure ([TimeoutException] Message: 
Stacktrace:
#0 0x55895b7a6bba <unknown>
#1 0x55895b244790 <unknown>
#2 0x55895b295c80 <unknown>
#3 0x55895b295e01 <unknown>
#4 0x55895b2e4944 <unknown>
#5 0x55895b2bba7d <unknown>
#6 0x55895b2e1ccc <unknown>
#7 0x55895b2bb823 <unknown>
#8 0x55895b287a88 <unknown>
#9 0x55895b288bf1 <unknown>
#10 0x55895b77015b <unknown>
#11 0x55895b7740e2 <unknown>
#12 0x55895b75d01c <unknown>
#13 0x55895b774cd4 <unknown>
#14 0x55895b74148f <unknown>
#15 0x55895b7954f8 <unknown>
#16 0x55895b7956c9 <unknown>
#17 0x55895b7a5a36 <unknown>
#18 0x7ff1fe43a1c4 <unknown>
)
Exception ignored in: <function Chrome.__del__ at 0x7ff12f74d3a0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/undetected_chromedriver/__init__.py", line 843, in __del__
  File "/usr/local/lib/python3.13/site-packages/undetected_chromedriver/__init__.py", line 766, in quit
  File "/usr/local/lib/python3.13/subprocess.py", line 2234, in kill
ImportError: sys.meta_path is None, Python is likely shutting down
@mrlemongrass
Copy link

Looks like your chromedriver's not updated. From time to time, Safeway will require a minimum driver... just do an update and upgrade via apt. 'apt update && apt upgrade'

Is this what it looks like when the WAF blocks you?

docker build -t localsafeway:latest https://github.com/smkent/safeway-coupons.git#main
...
docker run localsafeway
docker exec -it beautiful_haslett /bin/bash
safeway-coupons --dry-run --no-email --debug
Clipping coupons for Safeway account *****
Connect to safeway.com
Decline cookie prompt
Return to safeway.com after declining cookie prompt
Open Sign In sidebar
Would send email to *****
>>>>>>
Safeway account: *****
Error: Authentication Failure ([TimeoutException] Message: 
Stacktrace:
#0 0x55895b7a6bba <unknown>
#1 0x55895b244790 <unknown>
#2 0x55895b295c80 <unknown>
#3 0x55895b295e01 <unknown>
#4 0x55895b2e4944 <unknown>
#5 0x55895b2bba7d <unknown>
#6 0x55895b2e1ccc <unknown>
#7 0x55895b2bb823 <unknown>
#8 0x55895b287a88 <unknown>
#9 0x55895b288bf1 <unknown>
#10 0x55895b77015b <unknown>
#11 0x55895b7740e2 <unknown>
#12 0x55895b75d01c <unknown>
#13 0x55895b774cd4 <unknown>
#14 0x55895b74148f <unknown>
#15 0x55895b7954f8 <unknown>
#16 0x55895b7956c9 <unknown>
#17 0x55895b7a5a36 <unknown>
#18 0x7ff1fe43a1c4 <unknown>
)
<<<<<<
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 71, in _chrome_driver
    yield driver
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 118, in _login
    wait.until(
    ~~~~~~~~~~^
        ec.visibility_of_element_located(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            (By.XPATH, "//span [contains(text(), 'Sign In')]")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        )
        ^
    ).click()
    ^
  File "/usr/local/lib/python3.13/site-packages/selenium/webdriver/support/wait.py", line 146, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: 
Stacktrace:
#0 0x55895b7a6bba <unknown>
#1 0x55895b244790 <unknown>
#2 0x55895b295c80 <unknown>
#3 0x55895b295e01 <unknown>
#4 0x55895b2e4944 <unknown>
#5 0x55895b2bba7d <unknown>
#6 0x55895b2e1ccc <unknown>
#7 0x55895b2bb823 <unknown>
#8 0x55895b287a88 <unknown>
#9 0x55895b288bf1 <unknown>
#10 0x55895b77015b <unknown>
#11 0x55895b7740e2 <unknown>
#12 0x55895b75d01c <unknown>
#13 0x55895b774cd4 <unknown>
#14 0x55895b74148f <unknown>
#15 0x55895b7954f8 <unknown>
#16 0x55895b7956c9 <unknown>
#17 0x55895b7a5a36 <unknown>
#18 0x7ff1fe43a1c4 <unknown>


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

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 59, in __init__
    self._login(account)
    ~~~~~~~~~~~^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 96, in _login
    with self._chrome_driver() as driver:
         ~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/contextlib.py", line 162, in __exit__
    self.gen.throw(value)
    ~~~~~~~~~~~~~~^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 79, in _chrome_driver
    raise ExceptionWithAttachments(
        f"[{type(e).__name__}] {e}", attachments=attachments
    ) from e
safeway_coupons.session.ExceptionWithAttachments: [TimeoutException] Message: 
Stacktrace:
#0 0x55895b7a6bba <unknown>
#1 0x55895b244790 <unknown>
#2 0x55895b295c80 <unknown>
#3 0x55895b295e01 <unknown>
#4 0x55895b2e4944 <unknown>
#5 0x55895b2bba7d <unknown>
#6 0x55895b2e1ccc <unknown>
#7 0x55895b2bb823 <unknown>
#8 0x55895b287a88 <unknown>
#9 0x55895b288bf1 <unknown>
#10 0x55895b77015b <unknown>
#11 0x55895b7740e2 <unknown>
#12 0x55895b75d01c <unknown>
#13 0x55895b774cd4 <unknown>
#14 0x55895b74148f <unknown>
#15 0x55895b7954f8 <unknown>
#16 0x55895b7956c9 <unknown>
#17 0x55895b7a5a36 <unknown>
#18 0x7ff1fe43a1c4 <unknown>


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

Traceback (most recent call last):
  File "/usr/local/bin/safeway-coupons", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/app.py", line 125, in main
    sc.clip_for_account(account)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/safeway.py", line 38, in clip_for_account
    swy = SafewayClient(account, self.debug_dir)
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/client.py", line 17, in __init__
    self.session = LoginSession(account, debug_dir)
                   ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 61, in __init__
    raise AuthenticationFailure(
        e, account, attachments=e.attachments
    ) from e
safeway_coupons.errors.AuthenticationFailure: Authentication Failure ([TimeoutException] Message: 
Stacktrace:
#0 0x55895b7a6bba <unknown>
#1 0x55895b244790 <unknown>
#2 0x55895b295c80 <unknown>
#3 0x55895b295e01 <unknown>
#4 0x55895b2e4944 <unknown>
#5 0x55895b2bba7d <unknown>
#6 0x55895b2e1ccc <unknown>
#7 0x55895b2bb823 <unknown>
#8 0x55895b287a88 <unknown>
#9 0x55895b288bf1 <unknown>
#10 0x55895b77015b <unknown>
#11 0x55895b7740e2 <unknown>
#12 0x55895b75d01c <unknown>
#13 0x55895b774cd4 <unknown>
#14 0x55895b74148f <unknown>
#15 0x55895b7954f8 <unknown>
#16 0x55895b7956c9 <unknown>
#17 0x55895b7a5a36 <unknown>
#18 0x7ff1fe43a1c4 <unknown>
)
Exception ignored in: <function Chrome.__del__ at 0x7ff12f74d3a0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/undetected_chromedriver/__init__.py", line 843, in __del__
  File "/usr/local/lib/python3.13/site-packages/undetected_chromedriver/__init__.py", line 766, in quit
  File "/usr/local/lib/python3.13/subprocess.py", line 2234, in kill
ImportError: sys.meta_path is None, Python is likely shutting down

@vertex
Copy link

vertex commented Feb 20, 2025

I get this

>>>>>>
Safeway account: <redacted>@<redacted>.com
Error: Authentication Failure ([TimeoutException] Message: 
Stacktrace:
#0 0x562893bb6bea <unknown>
#1 0x5628936547d0 <unknown>
#2 0x5628936a5cc0 <unknown>
#3 0x5628936a5e41 <unknown>
#4 0x5628936f4984 <unknown>
#5 0x5628936cbabd <unknown>
#6 0x5628936f1d0c <unknown>
#7 0x5628936cb863 <unknown>
#8 0x562893697ac8 <unknown>
#9 0x562893698c31 <unknown>
#10 0x562893b8018b <unknown>
#11 0x562893b84112 <unknown>
#12 0x562893b6d04c <unknown>
#13 0x562893b84d04 <unknown>
#14 0x562893b514bf <unknown>
#15 0x562893ba5528 <unknown>
#16 0x562893ba56f9 <unknown>
#17 0x562893bb5a66 <unknown>
#18 0x145faf9bc1c4 <unknown>
)
<<<<<<
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 71, in _chrome_driver
    yield driver
  File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 118, in _login
    wait.until(
    ~~~~~~~~~~^
        ec.visibility_of_element_located(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            (By.XPATH, "//span [contains(text(), 'Sign In')]")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        )
        ^
    ).click()
    ^
  File "/usr/local/lib/python3.13/site-packages/selenium/webdriver/support/wait.py", line 105, in until
    raise TimeoutException(message, screen, stacktrace)

Looking at safeway.com it looks like Sign In may have changed to Sign in (lowercase i)

@jvasa
Copy link

jvasa commented Feb 20, 2025

For a permanent fix -- this adds a cronjob that does the apt update / apt upgrade to automatically update the chromedriver/updates.

It updates the "entrypoint" to start busybox which adds a second cron job run daily.

In the docker-compose.yaml file add this:

   entrypoint: >
      bash -c "
      apt update &&
      apt upgrade -y &&
      mkdir -vp /var/local/cron/crontabs &&
      install -m 755 <(echo '0 2 * * * apt update && apt upgrade -y >/proc/1/fd/1 2>/proc/1/fd/2') /var/local/cron/crontabs/root &&
      busybox crontab -l -c /var/local/cron/crontabs &&
      busybox crond -c /var/local/cron/crontabs &&
      /entrypoint"

Try this out, it's been working for me for months.

@vertex
Copy link

vertex commented Feb 20, 2025

@jvasa I have the drivers updated and I still see the issue. I think it's something Safeway is rolling out. I added a MR #134

@jvasa
Copy link

jvasa commented Feb 20, 2025

I haven't yet to see this update.

I am using a different URL instead of just safeway.com for sign in at
url = "https://www.safeway.com/account/sign-in.html"
which I don't think has this case sensitive update.

This is from @brandoncasaba in november branch at https://github.com/brandoncasaba/safeway-coupons/tree/Nov-2024-ui-change

@qtang
Copy link

qtang commented Feb 23, 2025

Try the workaround described here: #131 (comment)

Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 71, in _chrome_driver
yield driver
File "/usr/local/lib/python3.13/site-packages/safeway_coupons/session.py", line 118, in _login
wait.until(
~~~~~~~~~~^
ec.visibility_of_element_located(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(By.XPATH, "//span [contains(text(), 'Sign In')]")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
).click()
^
File "/usr/local/lib/python3.13/site-packages/selenium/webdriver/support/wait.py", line 146, in until
raise TimeoutException(message, screen, stacktrace)

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

Successfully merging a pull request may close this issue.

5 participants