How to fix "net::ERR_CERT_DATE_INVALID" error in Puppeteer

Puppeteer

Why this happens

net::ERR_CERT_DATE_INVALID means the TLS certificate on the target site has expired or its validity period has not started yet. Chrome (which Puppeteer drives) rejects the connection by default because the certificate is no longer trusted. This happens most often when scraping internal tools, staging environments, or older sites that have not renewed their certificates.

How to bypass it

Pass --ignore-certificate-errors as a Chrome launch argument. This tells Chromium to skip all certificate validation and load the page anyway.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch({
  args: ['--ignore-certificate-errors'],
});

const page = await browser.newPage();
await page.goto('https://expired-cert-site.example.com');

const content = await page.content();
console.log(content);

await browser.close();

If you also need to handle self-signed certificates or other TLS errors in the same run, add --ignore-certificate-errors-spki-list or simply rely on --ignore-certificate-errors which covers all certificate failures.

Alternative: per-request bypass with setBypassCSP

setBypassCSP does not help here — it only affects Content Security Policy, not TLS. Stick with the launch argument.

Notes

  • This flag disables certificate validation for the entire browser session. Only use it in controlled scraping environments, not in user-facing browsers.
  • In headless server environments, also add --no-sandbox and --disable-setuid-sandbox if you see related permission errors alongside the cert error.
  • If you are using WebCrawlerAPI to crawl pages at scale, TLS errors are handled automatically — you do not need to manage browser flags yourself.

See also