ajv icon indicating copy to clipboard operation
ajv copied to clipboard

Drop dependency on uri-js/punycode

Open gajus opened this issue 2 years ago • 5 comments

What version of Ajv you are you using?

v6.12.6

What problem do you want to solve?

Logs being flooded with deprecation warnings:

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

What do you think is the correct solution to problem?

  • Drop Node.js support outside of LTE
  • Drop uri-js (which depends on punycode)

Will you be able to implement it?

Yes

Related issues:

  • https://github.com/garycourt/uri-js/issues/94

Note:

  • My understanding is that the only reason for uri-js is backwards compatibility for older Node.js versions.

gajus avatar Oct 30 '23 15:10 gajus

Also happens in newer version "ajv": "^8.12.0" https://github.com/ajv-validator/ajv/issues/2350

mikicymulate avatar Dec 03 '23 11:12 mikicymulate

I've opened a PR to fix this in uri-js, the package ajv depends on here: https://github.com/garycourt/uri-js/pull/95

domdomegg avatar Dec 06 '23 13:12 domdomegg

uri-js is no longer being maintained, so there's not a great chance of it being fixed upstream.

You can also nvm install 20 && nvm use 20 to go back to Node v20.11.1 and silence it for now until ajv/eslint/etc update their dependencies

iwasrobbed avatar Mar 08 '24 22:03 iwasrobbed

Hi there, I created a replacement for library uri-js as temporal solution.

  • Based on Node.js and browser URL api
  • 99% compatible with original URI.js library
  • Solves "The punycode module is deprecated" warning in Node
  • Tested with libraries: ESLint, Webpack, Ajv (runned all Ajv tests)

https://github.com/andreinwald/uri-js-replace

You can add to package.json of your project:

"overrides": {
    "uri-js": "npm:uri-js-replace"
 }

andreinwald avatar Apr 27 '24 14:04 andreinwald

how progress of this?

tianyingchun avatar May 09 '24 22:05 tianyingchun

seems this exists: https://www.npmjs.com/package/toad-uri-js

can this be done? it's really annoying to see when using eslint.

alternativel,y andreinwald's one can be used. i just found this asweel

Symmettry avatar Jun 07 '24 07:06 Symmettry

We're working on moving to fast-uri, just waiting for some compatibility fixes on their side so will close this as it is redundant with ongoing work.

jasoniangreen avatar Jun 15 '24 17:06 jasoniangreen

what's the progress on this? @jasoniangreen Is there another issue we can follow to know the progress?

bngo97 avatar Jul 23 '24 16:07 bngo97

do we have any progress? 🤗

Mon-ius avatar Aug 23 '24 18:08 Mon-ius

Using eslint that is dependent on ajv and I get alot of these deprecation warnings — which is really annoying.

Really looking forward for this to be solved...

jonascarlbaum avatar Sep 24 '24 20:09 jonascarlbaum

+1

tecoad avatar Oct 17 '24 11:10 tecoad

+1

emkelley avatar Oct 30 '24 14:10 emkelley

+1

fernandoravaneli avatar Nov 09 '24 22:11 fernandoravaneli

+1

timotheeduran avatar Nov 13 '24 12:11 timotheeduran

Any progress on this?

eraoul avatar Nov 30 '24 04:11 eraoul

+1

fiftyy avatar Dec 01 '24 13:12 fiftyy

+1

Symmettry avatar Dec 10 '24 05:12 Symmettry

+1

Nishanth-Gobi avatar Dec 12 '24 07:12 Nishanth-Gobi

Release v8.17.1 has removed uri-js

jasoniangreen avatar Dec 16 '24 00:12 jasoniangreen

As indicated by @jasoniangreen, version 8.17.1 of ajv is no longer dependent on punycode. If you're using eslint, you can add the following to your package.json.

// pnpm

{
  "pnpm": {
    "overrides": {
      "ajv": "8.17.1"
    }
  }
}

// terminal pnpm install

This will force eslint to use the newer version of "ajv".

johnholliday avatar Dec 30 '24 22:12 johnholliday

So, guess that means that for yarn 4.5+ I need to do?

{
  "resolutions": {
    "ajv": "8.17.1"
  }
}

will try it out soon…

jonascarlbaum avatar Jan 01 '25 01:01 jonascarlbaum

Any ETA? Still Warning

mtzrmzia avatar Feb 15 '25 19:02 mtzrmzia

We're working on moving to fast-uri, just waiting for some compatibility fixes on their side so will close this as it is redundant with ongoing work.

is there another PR/etc we can follow to see this progress? still seeing this error today - while this was closed in June

acidjazz avatar Mar 14 '25 21:03 acidjazz

We're working on moving to fast-uri, just waiting for some compatibility fixes on their side so will close this as it is redundant with ongoing work.

is there another PR/etc we can follow to see this progress? still seeing this error today - while this was closed in June

If you're like me then you're seeing this error because you're using a package that relies on node:punycode (not an npm version of punycode).

Try to find the root cause in your case by running node --trace-deprecation

For instance, when I ran this it turned out my issue was node-fetch which relies on node:punycode <-- that's the actual deprecated version.

slifty avatar Jul 15 '25 20:07 slifty