puppeteer: Certificates error using puppeteer

Hello,

I encountered a weird ssl problem using puppeeter 1.2.0 or 1.3.0 (inside a container).

Looking at this example (works on https://try-puppeteer.appspot.com/)

const browser = await puppeteer.launch({
  ignoreHTTPSErrors: true,
  headless: true
});

const page = await browser.newPage();


await Promise.all([
  page.waitForNavigation({timeout: 30000, waitUntil: 'networkidle2'}),
  page.goto('http://www.latabledarc.com/trianon-assiette-a-pain.html')
]);

await Promise.all([
  page.waitFor(5000),
  page.click('#product-addtocart-button')
]);

await Promise.all([
  page.waitForNavigation({timeout: 30000, waitUntil: 'networkidle2'}),
  page.goto('https://www.latabledarc.com/checkout/onepage/')
]);

console.log(await page.url());

await browser.close();

The problem is that I get the following error

Error running your code. Error: net::ERR_CERT_AUTHORITY_INVALID

Instead of to be allowed to navigate on the target url.

But if I try this in my browser everything is fine. The website has a valid ssl certificate.

On my local environment I get the following message using dumpio :

0414/115606.318905:ERROR:nss_ocsp.cc(597)] No URLRequestContext for NSS HTTP handler. host: cacerts.thawte.com
[0414/115606.318962:ERROR:cert_verify_proc_nss.cc(980)] CERT_PKIXVerifyCert for www.latabledarc.com failed err=-8179

And this seems not to be the only website wich is affected by this problem.

Any clue ?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 14
  • Comments: 25

Commits related to this issue

Most upvoted comments

You can also set an args array inside the launch config

args: [ '--ignore-certificate-errors' ]

I have noticed that this only seems to work when headless if false.

Anyone seen a workaround for this? We’ve been banging our heads around this issue for a long while…

const puppeteer = require('puppeteer');
(async () => {
    const browser = await puppeteer.launch({ignoreHTTPSErrors: true, acceptInsecureCerts: true, args: ['--proxy-bypass-list=*', '--disable-gpu', '--disable-dev-shm-usage', '--disable-setuid-sandbox', '--no-first-run', '--no-sandbox', '--no-zygote', '--single-process', '--ignore-certificate-errors', '--ignore-certificate-errors-spki-list', '--enable-features=NetworkService']});
    const page = await browser.newPage();
    try {

        await page.goto('https://www.hostwpsolutions.com/', {waitUntil: 'networkidle2', timeout: 59000});
        const cookies = await page._client.send('Network.getAllCookies');
        JSON.stringify(cookies, null, 4);
    } catch (e) {
        console.log(e);
    }

    await browser.close();
})();

Error: net::ERR_SSL_VERSION_OR_CIPHER_MISMATCH at https://www.xxxxxxsolutions.com/

{headless:true, args: [ '--enable-features=NetworkService ]} worked for me

await puppeteer.launch({ignoreHTTPSErrors: true});

I’ve raised this as an issue on https://bugs.chromium.org/p/chromium/issues/detail?id=877075 : any confirmation/example cases - feel free to add.

You can also set an args array inside the launch config

args: [ '--ignore-certificate-errors' ]

I have noticed that this only seems to work when headless if false.

This worked for me

I initialised the browser as

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

args: [ '--ignore-certificate-errors' ] dosn’t change anything (we are in headless). For RuslanTT as fas as we know the certificate is not present in the container so even with curl it’s impossible to connect to the website. By adding the certificate manually curl is working but not chrome this seems because chrome has his own directory for certificate, but we currently don’t know where is the directory for chrome. But for https://www.crediteurope.ch the problem seems simpler as the certificate is a 30 year lifetime certificate he is probably untrusted by chrome, see: https://security.googleblog.com/2018/03/distrust-of-symantec-pki-immediate.html

Anyone have any workarounds? This has been killing me for months.