Playwright browser download timeout / proxy failure in CI
playwright install opened the download but the transfer stalled past its timeout or the connection reset. This is transient network flakiness (a slow proxy, a large archive, packet loss) rather than a forbidden or missing file.
What this error means
The install step prints "Downloading Chromium ..." then fails with a socket timeout, "ECONNRESET", or "Download failed: connection timed out", sometimes after partially fetching the archive.
Downloading Chromium 124.0.6367.29 (playwright build v1140)
Error: Download failed: connect ETIMEDOUT
at ClientRequest.<anonymous> (.../playwright-core/lib/utils/download.js)Common causes
A slow or congested proxy
The browser archive is large; a slow egress proxy makes the transfer exceed the download timeout on a single attempt.
Transient packet loss mid-transfer
The connection resets partway through, and without a cache the whole download must start over.
How to fix it
Cache the browsers so downloads are rare
Persist the Playwright browsers directory so a slow network is not on the path every run.
- uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: pw-${{ hashFiles('package-lock.json') }}
- run: npx playwright install --with-depsRetry the install step
Wrap the install so a transient stall gets another attempt instead of failing the job.
for i in 1 2 3; do npx playwright install --with-deps && break; sleep 10; doneHow to prevent it
- Cache the browsers directory keyed on the lockfile.
- Retry the install step so a single stalled download does not fail the run.
- Use an internal
PLAYWRIGHT_DOWNLOAD_HOSTmirror on slow external links.