Skip to content

Failed to get AWS WAF token. #345

@michag86

Description

@michag86

Description of the bug
Cannot login. Getting Error: Failed to get AWS WAF token.

To Reproduce
Steps to reproduce the behavior:

Run this command block:

PHONE_NO="+1234567890"
DATE_SINCE=${1:-$(date '+%Y-%m-%d')}
LAST_DAYS=$(( ( $(date -d "now" +%s) - $(date -d "$DATE_SINCE" +%s) ) / 86400 ))
PYTR="pytr@v0.4.9"
docker run -v $PWD/data:/data -v $PWD/.cache:/root/.cache --rm -it  ghcr.io/astral-sh/uv:0.11.7-python3.11-trixie uvx $PYTR export_transactions --phone_no $PHONE_NO --last_days $LAST_DAYS --sort /data/transactions.csv

Expected behavior
Login works

Error log

09:36:49 Failed to get AWS WAF token.
Traceback (most recent call last):
  File "/root/.cache/uv/archive-v0/qgA0SttFeyP22xU3iXpOH/bin/pytr", line 12, in <module>
    sys.exit(main())
             ^^^^^^
  File "/root/.cache/uv/archive-v0/qgA0SttFeyP22xU3iXpOH/lib/python3.11/site-packages/pytr/main.py", line 506, in main
    login(
  File "/root/.cache/uv/archive-v0/qgA0SttFeyP22xU3iXpOH/lib/python3.11/site-packages/pytr/account.py", line 60, in login
    countdown = tr.initiate_weblogin()
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/archive-v0/qgA0SttFeyP22xU3iXpOH/lib/python3.11/site-packages/pytr/api.py", line 213, in initiate_weblogin
    self._waf_token = self._fetch_waf_token_playwright()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/archive-v0/qgA0SttFeyP22xU3iXpOH/lib/python3.11/site-packages/pytr/api.py", line 144, in _fetch_waf_token_playwright
    browser = p.chromium.launch(
              ^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/archive-v0/qgA0SttFeyP22xU3iXpOH/lib/python3.11/site-packages/playwright/sync_api/_generated.py", line 14566, in launch
    self._sync(
  File "/root/.cache/uv/archive-v0/qgA0SttFeyP22xU3iXpOH/lib/python3.11/site-packages/playwright/_impl/_sync_base.py", line 115, in _sync
    return task.result()
           ^^^^^^^^^^^^^
  File "/root/.cache/uv/archive-v0/qgA0SttFeyP22xU3iXpOH/lib/python3.11/site-packages/playwright/_impl/_browser_type.py", line 97, in launch
    await self._channel.send(
  File "/root/.cache/uv/archive-v0/qgA0SttFeyP22xU3iXpOH/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 69, in send
    return await self._connection.wrap_api_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/archive-v0/qgA0SttFeyP22xU3iXpOH/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 559, in wrap_api_call
    raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.TargetClosedError: BrowserType.launch: Target page, context or browser has been closed
Browser logs:

<launching> /root/.cache/ms-playwright/chromium_headless_shell-1208/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,BoundaryEventDispatchTracksNodeRemoval,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,AutoDeElevate,RenderDocument,OptimizationHints --enable-features=CDPScreenshotNewSurface --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --unsafely-disable-devtools-self-xss-warnings --edge-skip-compat-layer-relaunch --enable-automation --disable-infobars --disable-search-engine-choice-screen --disable-sync --enable-unsafe-swiftshader --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --no-sandbox --disable-setuid-sandbox --user-data-dir=/tmp/playwright_chromiumdev_profile-rfywOg --remote-debugging-pipe --no-startup-window
<launched> pid=70
[pid=70][err] /root/.cache/ms-playwright/chromium_headless_shell-1208/chrome-headless-shell-linux64/chrome-headless-shell: error while loading shared libraries: libnspr4.so: cannot open shared object file: No such file or directory
Call log:
  - <launching> /root/.cache/ms-playwright/chromium_headless_shell-1208/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,BoundaryEventDispatchTracksNodeRemoval,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,AutoDeElevate,RenderDocument,OptimizationHints --enable-features=CDPScreenshotNewSurface --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --unsafely-disable-devtools-self-xss-warnings --edge-skip-compat-layer-relaunch --enable-automation --disable-infobars --disable-search-engine-choice-screen --disable-sync --enable-unsafe-swiftshader --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --no-sandbox --disable-setuid-sandbox --user-data-dir=/tmp/playwright_chromiumdev_profile-rfywOg --remote-debugging-pipe --no-startup-window
  - <launched> pid=70
  - [pid=70][err] /root/.cache/ms-playwright/chromium_headless_shell-1208/chrome-headless-shell-linux64/chrome-headless-shell: error while loading shared libraries: libnspr4.so: cannot open shared object file: No such file or directory
  - [pid=70] <gracefully close start>
  - [pid=70] <kill>
  - [pid=70] <will force kill>
  - [pid=70] exception while trying to kill process: Error: kill ESRCH
  - [pid=70] <process did exit: exitCode=127, signal=null>
  - [pid=70] starting temporary directories cleanup
  - [pid=70] finished temporary directories cleanup
  - [pid=70] <gracefully close end>

Environment

  • OS: Linux
  • pytr version: v0.4.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions