ravendb / ravendb-nodejs-client

RavenDB node.js client
MIT License
63 stars 31 forks source link

Dependency on deprecated punycode module #404

Open jetzezoethout opened 8 months ago

jetzezoethout commented 8 months ago

Running a project using ravendb on the newest version of node (v21) yields a deprecation warning.

Minimal example

package.json

{
  "dependencies": {
    "ravendb": "5.4.1"
  },
  "scripts": {
    "start": "node main.js"
  }
}

main.js

const { DocumentStore } = require("ravendb");

const store = new DocumentStore(/* Your DB connection info */).initialize();

After running npm i, we get the following behaviour:

$ npm run start

> start
> node main.js

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

On older versions of node, the same warning can be seen by adding the --pending-deprecations flag.

The dependency on punycode seems to enter through node-fetch v2. Simply updating to v3 might do the trick.

Specific version information

ml054 commented 8 months ago

punycode is transtive dependency of eslint. Even when using latest version of eslint (8.52.0). Please also notice that eslint is dev dependency.

If you want to you can similar issue to eslint library.

ravendb@5.4.2 C:\workspaces\client-node\v5.4
`-- eslint@8.52.0
  `-- ajv@6.12.6
    `-- uri-js@4.4.1
      `-- punycode@2.3.0

In node-fetch I don't see dependency to punycode (https://github.com/node-fetch/node-fetch/blob/main/package.json)

jetzezoethout commented 8 months ago

Thanks for your quick reply! I'm aware that punycode is a transitive dependency of eslint, but dev dependencies shouldn't cause runtime warnings in node. I did a bit more digging: running node with the --trace-deprecations flag shows that punycode is used in whatwg-url, which enters through node-fetch:

$ npm list whatwg-url
Test@ ~/Documents/Test
└─┬ ravendb@5.4.1
  └─┬ node-fetch@2.7.0
    └── whatwg-url@5.0.0
ml054 commented 8 months ago

ok we will investigate that with node 21. Thanks :)

domdomegg commented 6 months ago

For the eslint dependency: https://github.com/garycourt/uri-js/pull/95