[pull] master from apify:master#245
Merged
Merged
Conversation
Puppeteer 25 is ESM-only, requires Node 22.12+, and its bundled Chrome
changes a few behaviors. This adds support for it while keeping
compatibility with older versions:
- suppress the type-only ESM import errors with inert `@ts-ignore`
comments (same approach as for got-scraping), so the code compiles
against both puppeteer 24 (CJS) and 25+ (ESM-only) — the published
`.d.ts` shape is unchanged
- map the removed `clickCount` click option to its `count` replacement
in `clickElements()`, passing both through so older versions keep
working
- set a `User-Agent` header from `gotoExtended()` via
`page.setUserAgent()`, since newer Chrome ignores it in
`setExtraHTTPHeaders()`
- normalize the new `sameSite: 'Default'` cookie value to `undefined` in
session cookies
- bound the `page.close()` call in request cleanup with a 5s timeout —
puppeteer 25 can hang it indefinitely when the page's navigation was
aborted (e.g. on a navigation timeout), which blocked the crawler
forever
No new runtime version detection was needed — the existing
`CdpBrowser`/`package.json` checks still work with v25, and
`require('puppeteer')` works there because v25's minimum Node has
`require(esm)`.
Everything is verified locally against both puppeteer 24.36.1 and 25.3.0
(build, type checks, and the full puppeteer test suites, including under
CPU load for the timeout tests).
Supersedes #3772.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )