From 0a61330964aadac9a63e6d70c286424278cda60f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ad=C3=A1mek?= Date: Thu, 26 Sep 2024 16:16:01 +0200 Subject: [PATCH] fix(puppeteer): rename `ignoreHTTPSErrors` to `acceptInsecureCerts` to support v23 Both options are now used internally, since those code paths are shared for playwright as well, and we want to support older puppeteer versions too. Also tested this locally with puppeteer v22, luckily there are no runtime validations for unknown options, so we can just use both. --- packages/browser-crawler/src/internals/browser-crawler.ts | 2 ++ test/e2e/puppeteer-ignore-ssl-errors/actor/main.js | 2 +- test/e2e/puppeteer-throw-on-ssl-errors/actor/main.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/browser-crawler/src/internals/browser-crawler.ts b/packages/browser-crawler/src/internals/browser-crawler.ts index 44844981cb27..3b162ed99954 100644 --- a/packages/browser-crawler/src/internals/browser-crawler.ts +++ b/packages/browser-crawler/src/internals/browser-crawler.ts @@ -530,6 +530,7 @@ export abstract class BrowserCrawler< */ newPageOptions.pageOptions = { ignoreHTTPSErrors: true, + acceptInsecureCerts: true, }; } } @@ -747,6 +748,7 @@ export abstract class BrowserCrawler< * @see https://github.com/puppeteer/puppeteer/blob/main/docs/api.md */ (launchContext.launchOptions as Dictionary).ignoreHTTPSErrors = true; + (launchContext.launchOptions as Dictionary).acceptInsecureCerts = true; } } diff --git a/test/e2e/puppeteer-ignore-ssl-errors/actor/main.js b/test/e2e/puppeteer-ignore-ssl-errors/actor/main.js index 1b6f54498f84..0a279d7d96b3 100644 --- a/test/e2e/puppeteer-ignore-ssl-errors/actor/main.js +++ b/test/e2e/puppeteer-ignore-ssl-errors/actor/main.js @@ -11,7 +11,7 @@ const mainOptions = { await Actor.main(async () => { const crawler = new PuppeteerCrawler({ - launchContext: { launchOptions: { ignoreHTTPSErrors: true } }, + launchContext: { launchOptions: { acceptInsecureCerts: true } }, preNavigationHooks: [ (_ctx, goToOptions) => { goToOptions.waitUntil = ['networkidle2']; diff --git a/test/e2e/puppeteer-throw-on-ssl-errors/actor/main.js b/test/e2e/puppeteer-throw-on-ssl-errors/actor/main.js index 49b739463b4d..03b223e3cfa0 100644 --- a/test/e2e/puppeteer-throw-on-ssl-errors/actor/main.js +++ b/test/e2e/puppeteer-throw-on-ssl-errors/actor/main.js @@ -11,7 +11,7 @@ const mainOptions = { await Actor.main(async () => { const crawler = new PuppeteerCrawler({ - launchContext: { launchOptions: { ignoreHTTPSErrors: false } }, // This is the default + launchContext: { launchOptions: { acceptInsecureCerts: false } }, // This is the default preNavigationHooks: [ (_ctx, goToOptions) => { goToOptions.waitUntil = ['networkidle2'];