aio-cli icon indicating copy to clipboard operation
aio-cli copied to clipboard

DeprecationWarning: The `punycode` module is deprecated

Open MichaelGoberling opened this issue 1 year ago • 2 comments

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.

MichaelGoberling avatar Jun 11 '24 16:06 MichaelGoberling

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 avatar Aug 14 '24 20:08 ConnorJamesLow

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.

ConnorJamesLow avatar Aug 14 '24 20:08 ConnorJamesLow

Closing this in favor of: https://github.com/adobe/aio-cli/issues/679

MichaelGoberling avatar Nov 14 '24 16:11 MichaelGoberling