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

(node:28848) [DEP0060] after updating to netlify 13.1.21/netlify-cli 17.36.2 #6836

Open
jeromelvwa opened this issue Sep 24, 2024 · 2 comments
Labels
type: bug code to address defects in shipped code

Comments

@jeromelvwa
Copy link

Describe the bug

After doing an "npm update" I now get the following error when I run "npx netlify dev":
(node:28848) [DEP0060] DeprecationWarning: The util._extend API is deprecated. Please use Object.assign() instead.
(Use node --trace-deprecation ... to show where the warning was created)

I can still deploy without issues but this is preventing me from full local testing. I can still use "npm run dev" and still work with some things.

Steps to reproduce

I just ran an "npm update".

Configuration

[functions]

external_node_modules = ["aws-sdk"]

# node_bundler = "esbuild"

[functions."flowpiechart"]

included_files = ["languages/**"]

[functions."review"]

included_files = ["languages/**"]

[functions."test"]

# included_files = ["languages/**"]

[dev]
targetPort = 4000

[functions."wb-sync-background"]

schedule = "@daily"

[[plugins]]
package = "@netlify/plugin-nextjs"

Environment

System:
OS: Windows 11 10.0.22631
CPU: (12) x64 AMD Ryzen 5 3600X 6-Core Processor
Memory: 14.13 GB / 31.93 GB
Binaries:
Node: 22.3.0 - C:\Program Files\nodejs\node.EXE
npm: 10.8.3 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.10.0 - ~\AppData\Local\pnpm\pnpm.EXE
npmPackages:
netlify-cli: ^17.36.2 => 17.36.2

@jeromelvwa jeromelvwa added the type: bug code to address defects in shipped code label Sep 24, 2024
@jeromelvwa
Copy link
Author

Additional info, "npx netlify build" completed without error.

@wconrad265
Copy link
Contributor

After doing some digging with @tlane25, we were able to pinpoint the cause of this error.

The deprecation warning you're seeing is indeed coming from the http-proxy library, which is a dependency used by Netlify CLI. I've investigated the issue, and I can provide some additional context:

Root cause:

The warning is due to the use of the deprecated util._extend API in the http-proxy library.

var httpProxy assignment on line 2 of http-proxy/lib/http-proxy/index.js where extend is assigned to the depreciated util._extend.

The issue stems from line 2 in the code below from http-proxy/lib/http-proxy/index.js.

utils._extend is depreciated and should be replaced with Object.assign().

var httpProxy = module.exports,
    extend    = require('util')._extend,
    parse_url = require('url').parse,
    EE3       = require('eventemitter3'),
    http      = require('http'),
    https     = require('https'),
    web       = require('./passes/web-incoming'),
    ws        = require('./passes/ws-incoming');

Existing solution

There is already a pull request (PR) to address this issue in the http-proxy repository:
http-party/node-http-proxy#1666

This PR replaces the usage of util._extend with Object.assign(), which should resolve the deprecation warning. The PR has been opened and is waiting to be reviewed and merged by the maintainers of the http-proxy library.

Workaround

The Node.js deprecation warning only seems to appear on versions of Node.js greater than 20. The warnings do not appear on Node.js version 20.18.0, but they do appear on your version (22.3.0). You can try using Node.js 20.18.0 to avoid the warning.

Furthermore if you need to use Node.js 22 or higher, you can try suppressing the warnings by doing the following.

set NODE_NO_WARNINGS=1
npx netlify dev

Remember to turn these off when your done!

set NODE_NO_WARNINGS=

Let me know if this helps you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

2 participants