newrelic / node-newrelic

New Relic Node.js agent code base. Developers are welcome to create pull requests here, please see our contributing guidelines. For New Relic technical support, please go to http://support.newrelic.com.
Apache License 2.0
968 stars 397 forks source link

[DEP0040] DeprecationWarning: The `punycode` module is deprecated. #2331

Closed Ac-ayush closed 2 months ago

Ac-ayush commented 2 months ago

Description

I am currently using Node 14 in my project and am now upgrading it to Node 22.4.0. However, when I start my project (node app.js) on Node 22.4.0, it gives me a DeprecationWarning. Previously, I was using "newrelic": "7.1.0" on node 14. Now with Node 22 I tried both "newrelic": "7.1.0" and the latest version, "newrelic": "11.22.0", but I am still facing the same issue.

@newrelic-node-agent-team @wesrog @kolanos please provide a solution for this.

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

Getting this description :

[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 Function.Module._load (node:internal/modules/cjs/loader:1070:17)
    at Function.wrappedLoad [as _load] (/Users/node_modules/newrelic/lib/shimmer.js:373:24)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)
    at Module.require (node:internal/modules/cjs/loader:1304:12)
    at require (node:internal/modules/helpers:123:16)

Current Node version used in project : node 14 Upgrading to: node 22.4.0

workato-integration[bot] commented 2 months ago

https://new-relic.atlassian.net/browse/NR-288538

jsumners-nr commented 2 months ago

👋 thank you for the report. Please provide a minimal reproducible example. Doing so will help us diagnose the issue. It should be the bare minimum code needed to trigger the issue, and easily runnable without any changes or extra code.

You may use a GitHub repository to host the code if it is too much to fit into a code block (or two).

Also, have you tried using --trace-deprecation to learn where the error originates?

mrickard commented 2 months ago

@Ac-ayush This deprecation warning is being thrown by Node itself. There's a notice about it and a recommended remediation in the Node documentation.

Closing this, as it's coming from the Node environment itself, and is not part of New Relic.