Redocly / redocly-cli

⚒️ Redocly CLI makes OpenAPI easy. Lint/validate to any standard, generate beautiful docs, and more.
https://redocly.com/docs/cli/
MIT License
871 stars 131 forks source link

punycode deprecation warning in node 21 #1332

Open twelvelabs opened 8 months ago

twelvelabs commented 8 months ago

Describe the bug

I'm getting a node depreciation warning whenever I run redocly on node v21. Looks like it's coming from whatwg-url. They appear to have fixed it in v13.0.0.

To Reproduce

$ node --version
v21.1.0

$ redocly --version
1.4.1

$ NODE_OPTIONS='--trace-deprecation' redocly lint
(node:48436) [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:392:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:328:10)
    at loadBuiltinModule (node:internal/modules/helpers:101:7)
    at Module._load (node:internal/modules/cjs/loader:1001:17)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/opt/homebrew/lib/node_modules/@redocly/cli/node_modules/whatwg-url/lib/url-state-machine.js:2:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
validating /src/schemas/default/openapi.yaml...
/src/schemas/default/openapi.yaml: validated in 3ms

Woohoo! Your API description is valid. 🎉

Expected behavior

No depreciation warning 😄.

Redocly Version(s)

1.4.1

Node.js Version(s)

v21.1.0

tatomyr commented 8 months ago

Thanks for reporting! We'll take a look at this.

bentcoder commented 7 months ago

Same here.

node: v21.2.0
npm: 10.2.4
yarn: 1.22.19

To reproduce.

FROM node:alpine3.18
ENV REDOCLY_TELEMETRY off
ENV NODE_OPTIONS --trace-deprecation
RUN npm install -g npm@10.2.4
RUN npm install -g @redocly/cli
WORKDIR /api
COPY spec.yaml /api
RUN redocly lint spec.yaml
tatomyr commented 7 months ago

The issue comes from AJV:


┬ @redocly/openapi-core@1.6.0 -> ./packages/core
└─┬ @redocly/ajv@8.11.0
  └─┬ uri-js@4.4.1
    └── punycode@2.1.1
RomanHotsiy commented 6 months ago

We need to update our fork to the upstream version I think.

domdomegg commented 6 months ago

See https://github.com/garycourt/uri-js/pull/95

drwpow commented 1 month ago

Update: problem also exists in Node 22 (current version)