Repository navigation
chore(deps)!: update @puppeteer/browsers to 3.x - #239
Closed
JacktheRanger wants to merge 1 commit into
Closed
JacktheRanger wants to merge 1 commit into
JacktheRanger wants to merge 1 commit into
Conversation
@cloudflare/puppeteer pinned @puppeteer/browsers 2.2.4, whose transitive tree (extract-zip, proxy-agent -> get-uri -> basic-ftp, socks -> ip-address) carries advisories that cannot be fixed on the 2.x line. 3.x drops those dependencies. Only the Node launcher imports the package, so Workers bundles are unchanged. 3.x is ESM-only and needs Node >= 22.12, so engines, .nvmrc and the Cloudflare test workflows move to Node 22, and the unit script switches to the glob form that Node 22's test runner needs. FirefoxLauncher ports upstream 9feda9c so cleanup restores the user.js backup that 3.x's createProfile writes. Refs #238 BREAKING CHANGE: @cloudflare/puppeteer now requires Node.js >= 22.12.0. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Author
|
Closing as superseded by #237. The new layout drops the vendored |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What kind of change does this PR introduce?
Dependency update. It is a breaking change because it raises the minimum Node.js version.
Did you add tests for your changes?
One existing launcher spec now also covers
user.js(userDataDir option restores preferences). That spec change comes with the upstream fix ported below. The existing unit and launcher suites cover the rest of the launcher paths.If relevant, did you update the documentation?
No. The README does not state a Node.js version, and
enginescarries the new requirement. See "Not included" fordocs/.Summary
Closes #238. This implements direction 1 from that issue.
Motivation
@cloudflare/puppeteerpins@puppeteer/browsersto2.2.4. Its transitive tree brings advisories into every downstream project:extract-zip: no patched release exists.basic-ftp: reached viaproxy-agent → pac-proxy-agent → get-uri. The fix is in 6.2.1, butget-uristill requires^5.ip-address: reached viasocks.Because the version is pinned exactly, downstream projects can only dismiss these alerts or add an
overridesentry.@puppeteer/browsers3.x removesextract-zipand makesproxy-agentan optional peer dependency, so the whole tree goes away.Only the Node launcher (
src/node/*) imports@puppeteer/browsers. The Workers entry point never loads it, so Workers bundles do not change.Changes
packages/puppeteer-core/package.json@puppeteer/browsers:2.2.4→^3.2.3. I used a caret range because the exact pin is the reason downstream lockfiles could not pick up fixes. Upstreampuppeteer-corepins exactly because it releases in lockstep with@puppeteer/browsers; this package does not.engines.node:>=18→>=22.12.0. This matches@puppeteer/browsers3.x and upstreampuppeteer-core25. The CJS build callsrequire()on the ESM-only package, which relies onrequire(esm).build:tscno longer depends on../browsers:build.puppeteer-corenow resolves the npm package instead of the in-repo workspace.packages/puppeteerandtest/installationstill declare that dependency themselves.unitscript now uses"lib/cjs/**/*.test.js", the same form upstreampuppeteer-core24.x uses. On Node 22 and later,node --testfails when given a directory argument.src/node/FirefoxLauncher.tsandtest/src/launcher.spec.ts: port upstream puppeteer/puppeteer@9feda9c (fix(firefox): back up user.js as well puppeteer/puppeteer#12943). Since@puppeteer/browsers2.3.1,createProfilebacks up an existinguser.jstouser.js.puppeteer. The 22.13.1 cleanup deleteduser.jsand never restored that backup. The port is verbatim so later upstream merges apply cleanly..nvmrc(v20 → v22) andcf_test_smoke.yml/cf_test_full.yml(20.x→22.x): CI should run on a supported Node.js version.publish.ymlalready uses Node 22.@puppeteer/browsers@3.2.3and its dependencies underpackages/puppeteer-core/node_modules(install-strategy=nested). No existing package changes version. npm also corrected the stale version recorded for the workspace (1.2.0 → 1.4.1).packages/puppeteer-cloudflare/tests/package-lock.json: only the metadata of the linked package changes.proxy-agent@8entries markedpeer optional. npm adds them only because the in-repo 2.2.4 workspace hoistsproxy-agent@6, which fails the optional peer range. A fresh downstream install does not include them (see Validation).Not included
packages/browsers(2.2.4) andpackages/puppeteerstay on 2.x. Neither is published, and upgrading them means re-vendoring the 3.x source. As a result, this repo's own lockfile still contains the 2.x tree. Downstream installs do not.docs/guides/system-requirements.mdstill says "Node 18+".docs/is upstream Puppeteer's documentation tree, and the README links to pptr.dev.@puppeteer/browsersreleases (AbortSignal support inlaunch,channelinconnect, thegetRecentLogs()-based error message,executablePath(LaunchOptions)) are features. They are not needed for compatibility.[Required] Puppeteer Unit testsCI job is unchanged. It runsnpm run unit -w puppeteer-core. That name has matched no workspace since the rename to@cloudflare/puppeteer, so the step exits 0 without running anything.Known costs
wrangleralready requires Node ≥ 22.require()from outsidenode_modules(for example this repo's unit tests) prints anExperimentalWarning. Consumers do not see it, because theirrequire()comes from insidenode_modules.userDataDirthat had nouser.js: after close, the generateduser.jsnow stays in the profile. Before, it was deleted. This is upstream's behavior since 9feda9c.linux_arm, sotrimCache()no longer removes browsers cached underlinux-*by 2.x.Validation
Measured on 2026-10-02 on macOS arm64. Install and gates used Node 22.23.3 with npm 10.9.9. Runtime checks also ran on Node 22.12.0, 24.21.0 and 26.4.0.
npm ci,npm run check,npm run validate-licenses,npm run build,npm run test-types,npm run lintandnpm run unitall exit 0, with 89/89 unit tests passing. The worktree is clean afternpm ci.mainfails both launcher test files on Node 26, because Node 26 loads yargs 17's extensionlessyargs/yargsentry as ESM.chrome-headlesssuite: Chrome 126.0.6478.182 was installed throughpackages/puppeteer's postinstall, which uses the in-repo 2.2.4. That means 3.x had to resolve a cache that 2.x wrote.mainfails the same 22 tests in the same environment (HiDPI screenshot and mouse sizes, and a local proxy and DNS on this machine).npm auditreports 0 vulnerabilities. None ofextract-zip,basic-ftp,get-uri,proxy-agent,socksorip-addressis installed.@cloudflare/puppeteer/internal/puppeteer-core.jslaunches Chrome through both ESM and CJS on Node 22.12.0, 22.23.3, 24.21.0 and 26.4.0.puppeteer.launch(env.BROWSER)andpuppeteer.limits()withwrangler deploy --dry-run. Tarballs built frommainand from this branch produce byte-identicalindex.js(same md5). Neither the bundle nor its source map contains@puppeteer/browsers,yargsormodern-tar.packages/puppeteer-cloudflare/tests:npm cisucceeds.Does this PR introduce a breaking change?
Yes.
@cloudflare/puppeteernow requires Node.js ≥ 22.12.0. Code running in Workers is unaffected. Projects that use the Node launcher (internal/puppeteer-core.jsorinternal/node/*) on Node < 22.12 must upgrade Node.Other information
Draft #237 replaces this layout, and the
@cloudflare/puppeteerit builds no longer depends on@puppeteer/browsersat all. If #237 lands first, this PR is superseded. It is meant for a release cut from the current layout before then.🤖 Generated with Claude Code