Playwright: SSL peer certificate or SSH remote key was not OK

Created on 23 Jan 2020  路  5Comments  路  Source: microsoft/playwright

I'm getting the following error:

UnhandledPromiseRejectionWarning: Error: Navigation to https://stranger.nl/ failed: SSL peer certificate or SSH remote key was not OK.

Is there an option or configuration to disable SSL verification? But to my knowledge my website has a valid SSL certificate.

/Stefan

Most helpful comment

@stefanstranger So to summarize:

  • certificate works on Chrome/ Edgium
  • certificate doesn't work on Firefox

And similar situation is with playwright:

const { chromium, webkit } = require('playwright');

(async () => {
  for (const type of [chromium, firefox]) {
    const browser = await type.launch();
    const context = await browser.newContext();
    const page = await context.newPage('https://stranger.nl/').catch(e => null);
    console.log(`Loaded: ` + (page ? 'YES' : 'NO')); // YES for chromium, NO for firefox
    await browser.close();
  }
})();

PlayWright is consistent with what I see as a user. Which sounds great to me!

Closing this; let us know if we missed something here!

All 5 comments

I assume this is with webkit on linux? I get an https error for your site when I try to view it in GNOME Web. Playwright successfully found a cross browser error for you! :)

More seriously, I assume our linux webkit is using different root certificates than iOS/Mac webkit. I don't see an error with your site when I view it from an iPhone. Maybe we can add some certificates to more closely match the Safari experience.

I can repro this on Windows with both WebKit and Firefox. Chromium works fine.

You can try ignoreHTTPSErrors as a workaround while we are figuring the CAs out.

const { webkit } = require('playwright');

(async () => {
  const browser = await webkit.launch();
  const context = await browser.newContext({ ignoreHTTPSError: true });
  const page = await context.newPage('https://stranger.nl/');
  await page.screenshot({ path: 'stranger.png' });
  await browser.close();
})();

Also, to Joel's point, I just tried it with stock Firefox on Windows and it did not like the certificate either!

Screen Shot 2020-01-24 at 8 05 25 PM

Well it's just a Lets Encrypt certificate. And wel I check the cert in Edge its OK.

@stefanstranger So to summarize:

  • certificate works on Chrome/ Edgium
  • certificate doesn't work on Firefox

And similar situation is with playwright:

const { chromium, webkit } = require('playwright');

(async () => {
  for (const type of [chromium, firefox]) {
    const browser = await type.launch();
    const context = await browser.newContext();
    const page = await context.newPage('https://stranger.nl/').catch(e => null);
    console.log(`Loaded: ` + (page ? 'YES' : 'NO')); // YES for chromium, NO for firefox
    await browser.close();
  }
})();

PlayWright is consistent with what I see as a user. Which sounds great to me!

Closing this; let us know if we missed something here!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KevinGrandon picture KevinGrandon  路  4Comments

osmenia picture osmenia  路  4Comments

arjunattam picture arjunattam  路  4Comments

pdehaan picture pdehaan  路  3Comments

juliomatcom picture juliomatcom  路  3Comments