Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeprecationWarning about punycode on Node.js 21 #2676

Open
justmoon opened this issue Apr 2, 2024 · 2 comments · May be fixed by #2678
Open

DeprecationWarning about punycode on Node.js 21 #2676

justmoon opened this issue Apr 2, 2024 · 2 comments · May be fixed by #2678

Comments

@justmoon
Copy link
Contributor

justmoon commented Apr 2, 2024

When loading the xrpl module in Node.js 21, a deprecation warning is issued.

(node:99818) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
  • node-fetch@2 won't fix this issue, so cross-fetch would have to upgrade to to node-fetch@3
  • cross-fetch won't upgrade to node-fetch@3 due to wanting cjs compatibility.

Possible solutions

  • Switch to node-fetch@3 and remove cross-fetch. (I haven't really looked at what cross-fetch actually adds, so that might not be an option.)
  • Use native Node.js fetch (available from Node.js 18+)
  • Use native (or user-supplied) fetch and only load the polyfill if needed
  • Include punycode npm module as a dependency and force bundler to use it
  • Wait for cross-fetch to fix it (though it doesn't look like they are going to anytime soon)

Upstream issues

lquixada/cross-fetch#177
node-fetch/node-fetch#1797

Dependency tree

xrpl 3.0.0
└─┬ cross-fetch 4.0.0
  └─┬ node-fetch 2.7.0
    └── whatwg-url 5.0.0
Full stacktrace
(node:99818) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
    at node:punycode:3:9
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:398:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:337:10)
    at loadBuiltinModule (node:internal/modules/helpers:104:7)
    at Function.Module._load (node:internal/modules/cjs/loader:999:17)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at Object. (/opt/workspace/justmoon/dassie/node_modules/.pnpm/whatwg-url@5.0.0/node_modules/whatwg-url/lib/url-state-machine.js:2:18)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1021:12)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at Object. (/opt/workspace/justmoon/dassie/node_modules/.pnpm/whatwg-url@5.0.0/node_modules/whatwg-url/lib/URL-impl.js:2:13)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1021:12)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at Object. (/opt/workspace/justmoon/dassie/node_modules/.pnpm/whatwg-url@5.0.0/node_modules/whatwg-url/lib/URL.js:5:14)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1021:12)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at Object. (/opt/workspace/justmoon/dassie/node_modules/.pnpm/whatwg-url@5.0.0/node_modules/whatwg-url/lib/public-api.js:3:15)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1021:12)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at Object. (/opt/workspace/justmoon/dassie/node_modules/.pnpm/node-fetch@2.7.0/node_modules/node-fetch/lib/index.js:10:33)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1021:12)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at Object. (/opt/workspace/justmoon/dassie/node_modules/.pnpm/cross-fetch@4.0.0/node_modules/cross-fetch/dist/node-ponyfill.js:1:19)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1021:12)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at Object. (/opt/workspace/justmoon/dassie/node_modules/.pnpm/xrpl@3.0.0/node_modules/xrpl/src/Wallet/fundWallet.ts:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1021:12)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at Object. (/opt/workspace/justmoon/dassie/node_modules/.pnpm/xrpl@3.0.0/node_modules/xrpl/src/client/index.ts:74:1)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1021:12)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at Object. (/opt/workspace/justmoon/dassie/node_modules/.pnpm/xrpl@3.0.0/node_modules/xrpl/src/index.ts:1:1)
@justinr1234 justinr1234 linked a pull request Apr 4, 2024 that will close this issue
9 tasks
@justinr1234
Copy link
Collaborator

justinr1234 commented Apr 4, 2024

Removing support for node 16, which needed to be done anyway. #2678

Thanks for bringing this up and your detailed analysis!

@mvadari
Copy link
Collaborator

mvadari commented Apr 8, 2024

Reopening because this should only be closed when #2678 is merged.

@mvadari mvadari reopened this Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants