adobe / aio-cli

Adobe I/O Extensible CLI
https://www.adobe.io
Apache License 2.0
77 stars 33 forks source link

DeprecationWarning: The `punycode` module is deprecated #620

Open MichaelGoberling opened 3 months ago

MichaelGoberling commented 3 months ago

With Node 22, the following error message is output anytime aio is run:

(node:353) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

Fix recommended by Node here: https://nodejs.org/api/punycode.html#punycode. We'll likely need to figure out where punycode is being used and replace it with the userland version.

ConnorJamesLow commented 1 month ago

Full deprecation trace (using node's --trace-deprecation flag):

(node:46829) [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:96:7)
    at Module._load (node:internal/modules/cjs/loader:1063:17)
    at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
    at Module.require (node:internal/modules/cjs/loader:1297:12)
    at require (node:internal/modules/helpers:123:16)
    at Object.<anonymous> (/opt/homebrew/lib/node_modules/@adobe/aio-cli/node_modules/whatwg-url/lib/url-state-machine.js:2:18)
    at Module._compile (node:internal/modules/cjs/loader:1460:14)
ConnorJamesLow commented 1 month ago

This is due to node-fetch requiring an out-of-date version (5.0.0, current is 14.0.0) of whatwg-url (https://www.npmjs.com/package/whatwg-url/v/5.0.0?activeTab=code) which includes an out-of-date version of tr-46 which incorrectly imported the puny-code package for versions 3.0.0 and older.

This project either needs to upgrade to a 3.x.x version of node-fetch, or node-fetch needs to upgrade their 2.x.x's whatwg-url version to one that supports a newer version of tr-46.

Update Third option is to override the version of whatwg-url: https://github.com/node-fetch/node-fetch/issues/1797#issuecomment-2275945670.