Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Playwright browser download fails behind a company proxy with a certificate error

ErrorError: self signed certificate in certificate chain

Short answer

Playwright downloads browsers over HTTPS, and a proxy that re-signs traffic with its own root certificate makes Node.js reject the connection. Tell Node.js to trust that root with NODE_EXTRA_CA_CERTS, route through the right proxy, or download from an internal mirror.

  • Applies to Playwright 1.5x, Node.js 22
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Check whether a proxy or a custom root certificate is already configured in your shell. The result decides which cause below you follow.

    env | grep -i -E "proxy|node_extra_ca_certs|playwright"
  2. 2Match what you see, then jump to its fix

    1. 1The error appears only on the company network or VPN, and the same command works on a home connectionThe network uses a custom root certificate Node.js does not trustFix
    2. 2Connection errors on a network where all web traffic must go through a proxyDownloads must go through a proxy that is not setFix
    3. 3Your IT team gives you a mirror address, and the internal server uses a private certificateYour company hosts the browser files on an internal serverFix

What does the error look like?

  • Error: self signed certificate in certificate chain

Cause 1 of 3

The network uses a custom root certificate Node.js does not trust

1Check

A traffic-inspecting proxy presents a certificate signed by its own root. Node.js extends its well-known root list only with the file named in NODE_EXTRA_CA_CERTS, which is read once at process start.

echo "$NODE_EXTRA_CA_CERTS"

2Fix

Export the company root certificate as a PEM file and set NODE_EXTRA_CA_CERTS to it before installing the browsers.

export NODE_EXTRA_CA_CERTS="/path/to/cert.pem"
npx playwright install

3Verify

The download starts instead of failing.

npx playwright install chromium

Confirmed by nodejs.org

Did this fix it?

Cause 2 of 3

Downloads must go through a proxy that is not set

1Check

Playwright can download browsers through a proxy server when HTTPS_PROXY is set for the command.

echo "$HTTPS_PROXY"

2Fix

Set HTTPS_PROXY to your proxy address for the install command. The address below is an example.

HTTPS_PROXY=https://192.0.2.1 npx playwright install

3Verify

The install proceeds.

HTTPS_PROXY=https://192.0.2.1 npx playwright install

Confirmed by playwright.dev

Did this fix it?

Cause 3 of 3

Your company hosts the browser files on an internal server

1Check

Playwright can download from another location through PLAYWRIGHT_DOWNLOAD_HOST. Browser-specific variables such as PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST take precedence over it.

env | grep PLAYWRIGHT

2Fix

Point the install at the mirror and keep NODE_EXTRA_CA_CERTS set if the mirror uses a private certificate authority.

PLAYWRIGHT_DOWNLOAD_HOST=http://192.0.2.1 npx playwright install

3Verify

Run the install again.

npx playwright install

Confirmed by playwright.dev

Did this fix it?

How do I stop it coming back?

  • Put NODE_EXTRA_CA_CERTS in the shell profile or CI environment so every Node.js tool trusts the company root.
  • Cache the browsers folder in CI so downloads happen rarely.
  • Set PLAYWRIGHT_BROWSERS_PATH to a shared folder when several projects use the same browsers.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

ng serve says it cannot determine the project or target

Cannot determine project for command.

The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.

3 causes, each with a fix

Back end

ng serve cannot find the dev-server builder package

Could not find the implementation for builder @angular/build:dev-server

The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.