fix: remove punycode deprecation warning (DEP0040) on every wrangler invocation - #14843
Open
Irishsmurf wants to merge 1 commit into
Open
fix: remove punycode deprecation warning (DEP0040) on every wrangler invocation#14843Irishsmurf wants to merge 1 commit into
Irishsmurf wants to merge 1 commit into
Conversation
…invocation
The bundled `cloudflare` API client depends on node-fetch@2.x, which
depends on whatwg-url@5.0.0 and its tr46@0.0.3 dependency. Both
directly `require("punycode")` against Node's deprecated built-in
module instead of the userland `punycode` package, so every wrangler
command logs:
(node:...) [DEP0040] DeprecationWarning: The `punycode` module is
deprecated. Please use a userland alternative instead.
Patch both packages to require the userland `punycode` package
instead (identical API, no behavior change) and wire it into the
dependency graph via packageExtensions, since pnpm doesn't re-resolve
a patched package's declared dependencies.
🦋 Changeset detectedLatest commit: a0f16c0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
workers-devprod
requested review from
a team and
emily-shen
and removed request for
a team
July 25, 2026 16:06
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
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.
Summary
Every
wranglerinvocation logs a Node deprecation warning:Root cause: the bundled
cloudflareAPI client (packages/wrangler'scloudflaredevDependency, used by@cloudflare/workers-utilstoo) depends onnode-fetch@2.x, which depends onwhatwg-url@5.0.0. Bothwhatwg-url@5.0.0itself and itstr46@0.0.3dependency directlyrequire("punycode")against Node's deprecated built-in module instead of the (API-identical) userlandpunycodenpm package.Note that
tr46's public API changed completely starting at v1.0.0 (positional-args API replaced with an options-object API, string returns replaced with{domain, error}objects), so bumpingtr46/whatwg-url's version isn't a safe fix forwhatwg-url@5.0.0— it would silently change IDNA/domain-parsing behavior. Bumping thecloudflareSDK to v7 (which droppednode-fetchand this whole dependency chain in favor of nativefetch) would fix it too, but that's a major-version bump used extensively throughout the codebase, better scoped and tested by folks who know every call site.Fix
Two
pnpm patches, both same-version (no behavior change):patches/tr46@0.0.3.patch:require("punycode")→require("punycode/")patches/whatwg-url@5.0.0.patch: same change inlib/url-state-machine.jsThe trailing slash forces Node to resolve the userland
punycodepackage instead of the deprecated builtin. Sincepnpm patchdoesn't re-resolve a patched package's declared dependencies, I addedpackageExtensionsentries inpnpm-workspace.yamlto properly wirepunycode@^2.3.1into both packages' dependency graphs (verified in the lockfile diff — it's a real dependency edge, not incidental hoisting).Test plan
pnpm turbo build --filter=wranglersucceedsgrep -n 'require(.punycode' wrangler-dist/cli.js— no matches (previously 2)NODE_OPTIONS='--trace-deprecation' node wrangler-dist/cli.js --version— no warningpnpm test -F wrangler— 250 test files, 4826 tests passedpnpm exec turbo check:type -F wrangler -F @cloudflare/workers-utils— passeswranglerand@cloudflare/workers-utils)