Skip to content

Commit

Permalink
fix(puppeteer): rename ignoreHTTPSErrors to acceptInsecureCerts t…
Browse files Browse the repository at this point in the history
…o support v23 (#2684)

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.
  • Loading branch information
B4nan authored Sep 26, 2024
1 parent beb186f commit f3927e6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/browser-crawler/src/internals/browser-crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ export abstract class BrowserCrawler<
*/
newPageOptions.pageOptions = {
ignoreHTTPSErrors: true,
acceptInsecureCerts: true,
};
}
}
Expand Down Expand Up @@ -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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/puppeteer-ignore-ssl-errors/actor/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/puppeteer-throw-on-ssl-errors/actor/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down

0 comments on commit f3927e6

Please sign in to comment.