Skip to content

DeprecationWarning: The util._extend API is deprecated. Please use Object.assign() instead. #74460

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

Open
kuanjiahong opened this issue Jan 2, 2025 · 11 comments
Labels
linear: next Confirmed issue that is tracked by the Next.js team. Runtime Related to Node.js or Edge Runtime with Next.js.

Comments

@kuanjiahong
Copy link

kuanjiahong commented Jan 2, 2025

Link to the code that reproduces this issue

https://github.com/kuanjiahong/deprecation-warning-app

To Reproduce

Development mode

  1. Start the application in development npm run dev
  2. Go to http://localhost:3000
  3. Click the button to rewrite the url
  4. Check the console for the deprecation warning

Deployment - Node.js Server

  1. Build the application npm run build
  2. Run the application npm run start
  3. Go to http://localhost:3000
  4. Click the button to rewrite the url
  5. Check the console for the deprecation warning

Deployment - Docker image

  1. Build container docker build -t nextjs-docker .
  2. Run container: docker run -p 3000:3000 nextjs-docker
  3. Go to http://localhost:3000
  4. Click the button to rewrite the url
  5. Check the console for the deprecation warning

Current vs. Expected behavior

Current behaviour:

A deprecation warning is shown:

[DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

When used node --trace-deprecation to show where the warning was created:

(node:1) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
    at ProxyServer.<anonymous> (/app/node_modules/next/dist/compiled/http-proxy/index.js:13:2607)
    at proxyRequest (/app/node_modules/next/dist/server/lib/router-utils/proxy-request.js:108:15)
    at handleRequest (/app/node_modules/next/dist/server/lib/router-server.js:332:61)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async requestHandlerImpl (/app/node_modules/next/dist/server/lib/router-server.js:441:13)
    at async Server.requestListener (/app/node_modules/next/dist/server/lib/start-server.js:155:13)

Expected behaviour:
No deprecation warning.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Enterprise
  Available memory (MB): 32562
  Available CPU cores: 8
Binaries:
  Node: 22.12.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.1.1-canary.23 // Latest available version is detected (15.1.1-canary.23).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.3.3
Next.js Config:
  output: standalone

Which area(s) are affected? (Select all that apply)

Runtime

Which stage(s) are affected? (Select all that apply)

next dev (local), next start (local), Other (Deployed)

Additional context

I found these related issue: #72220 #71374

I found that this issue start to occur when using Node version >= 22.

This issue does not occur when using Node v20.

@kuanjiahong kuanjiahong added the bug Issue was opened via the bug report template. label Jan 2, 2025
@github-actions github-actions bot added the Runtime Related to Node.js or Edge Runtime with Next.js. label Jan 2, 2025
@Netail
Copy link
Contributor

Netail commented Jan 2, 2025

Upstream; http-proxy; http-party/node-http-proxy#1666

But the issue is, this library hasn't been touched for 5 years...

@samcx samcx removed the bug Issue was opened via the bug report template. label Jan 23, 2025
@rdoetjes
Copy link

I have the same issue, and it worries me that Azure is not maintaining this library as it seems.

@github-actions github-actions bot added the linear: next Confirmed issue that is tracked by the Next.js team. label Feb 3, 2025
@thecodermehedi

This comment has been minimized.

@KaedeYure
Copy link

Same issue here. Tried the latest and lts version of nodejs and both gave the deprecation warning.

@tlaukkan

This comment has been minimized.

@t7ru
Copy link

t7ru commented Apr 7, 2025

Using latest version of node and yup, same warning when proxying.

@mstade
Copy link

mstade commented Apr 13, 2025

This API was given a runtime deprecation (i.e. throwing warnings) starting with Node v22: https://nodejs.org/api/deprecations.html#dep0060-util_extend

Unfortunately it doesn't seem like NodeJS is providing any information about end-of-life for this API: https://nodejs.org/api/deprecations.html#deprecated-apis

Presumably though, this warning will last at least until v24 is made Active LTS, which is scheduled for Oct 28, 2025. If someone from Vercel is reading this: please ensure this is resolved before then – many thanks! 🙏

@meishibiexuejava
Copy link

我也是这个问题,但我发现这个库好久都没人维护了,而没找到2.x的版本,有解决方法吗?

@meishibiexuejava
Copy link

meishibiexuejava commented Apr 24, 2025

我也是这个问题,但是我发现这个库好久没人维护了,而没有找到2.x的版本,有解决方法吗?

npm install http-proxy-node16 --save-dev

"devDependencies": {
"@vue/cli-service": "4.5.0",
"http-proxy-node16": "^1.0.6",
},
"overrides": {
"http-proxy": "npm:http-proxy-node16@^1.0.6"
},

这样处理后,没有在提示 api过期了

@mattduggan
Copy link

Patching the http-proxy module doesn't work, the patch must be applied to next itself as the dependency is coming from an internal compiled directory next/dist/compiled.

@passariello
Copy link

Same with 'http-proxy-middleware'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear: next Confirmed issue that is tracked by the Next.js team. Runtime Related to Node.js or Edge Runtime with Next.js.
Projects
None yet
Development

No branches or pull requests