Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. #1283

Open
tlunsfordCXP opened this issue Apr 15, 2024 · 6 comments
Labels
bug Something isn't working source-code-integration Related to [git-metadata]

Comments

@tlunsfordCXP
Copy link

Bug description

Running datadog-ci git-metadata upload returns the following error every time:

[DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.

This sort of warning makes it very difficult to maintain clean CI/CD pipelines. These warnings build up and eventually hide items that are real issues. ...which make this sort of issue a real issue.

The history of this repo shows the warning as occurring in this code for well over a year.

Describe what you expected

No warning.

Steps to reproduce the issue

datadog-ci git-metadata upload

Additional context

Run in docker container datadog/ci.

Command

git-metadata

@tlunsfordCXP tlunsfordCXP added the bug Something isn't working label Apr 15, 2024
@github-actions github-actions bot added the source-code-integration Related to [git-metadata] label Apr 15, 2024
@Drarig29
Copy link
Contributor

Hi @tlunsfordCXP! What version of the Docker image are you using?

@tlunsfordCXP
Copy link
Author

tlunsfordCXP commented Apr 15, 2024 via email

@Drarig29
Copy link
Contributor

Drarig29 commented Apr 15, 2024

Thanks for reporting!

The issue started in datadog/ci:v2.25.0 because the Node.js version bundled in the Docker image went from v20.8.1 to v21.4.0:

$ docker run --entrypoint node datadog/ci:v2.24.1 --version
v20.8.1

$ docker run --entrypoint node datadog/ci:v2.25.0 --version
v21.4.0

To reproduce the issue:

$ docker run -e NODE_OPTIONS=--trace-deprecation datadog/ci:v2.25.0 2>&1 | tail -n 14

You can also print more details about any of these commands by calling them with 
the `-h,--help` flag right after the command name.
(node:1) [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:397:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:333: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> (/usr/local/lib/node_modules/@datadog/datadog-ci/node_modules/ent/encode.js:1:16)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)

As you can see, the warning comes from ent, which is a 9-years-old package to decode HTML entities.

It uses punycode, which used to be a native module in Node.js but which is deprecated starting from Node 21.

This package is imported by @google-cloud/common:

$ yarn why -R ent

└─ @datadog/datadog-ci@workspace:.
   └─ @google-cloud/logging@npm:11.0.0 (via npm:^11.0.0)
      └─ @google-cloud/common@npm:5.0.1 (via npm:^5.0.0)
         └─ ent@npm:2.2.0 (via npm:^2.2.0)

Since ent isn't maintained anymore, and the corresponding repository was deleted, I'll make a PR on @google-cloud/common to use a different package.

@tlunsfordCXP
Copy link
Author

tlunsfordCXP commented Apr 15, 2024 via email

@Drarig29
Copy link
Contributor

Drarig29 commented May 2, 2024

Hi @tlunsfordCXP!

googleapis/nodejs-common#812 was merged and released! 🎉

But sadly, the warning still remains, and this time it's because of the node-fetch package, which is used by gaxios (used in multiple Google API packages).

This was already reported in googleapis/gaxios#429 (comment), and is tracked in googleapis/gaxios#508.

We'll have to wait for gaxios to get rid of this warning. 🙇

@tlunsfordCXP
Copy link
Author

tlunsfordCXP commented May 3, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working source-code-integration Related to [git-metadata]
Projects
None yet
Development

No branches or pull requests

2 participants