nextjs - 💡(How to fix) Fix Deprecation warning: util._extend in compiled http-proxy [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#90402Fetched 2026-04-08 00:20:16
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
closed ×1commented ×1labeled ×1locked ×1

Next.js bundles an old version of http-proxy at next/dist/compiled/http-proxy/index.js that uses require('util')._extend, which is deprecated since Node.js v22 (DEP0060).

During production runtime, this produces the following warning:

(node:179431) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.

The offending line in next/dist/compiled/http-proxy/index.js:

var n = r(837)._extend;

This is require('util')._extend, used in the setupOutgoing function to shallow-copy headers.

Root Cause

Next.js bundles an old version of http-proxy at next/dist/compiled/http-proxy/index.js that uses require('util')._extend, which is deprecated since Node.js v22 (DEP0060).

During production runtime, this produces the following warning:

(node:179431) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.

The offending line in next/dist/compiled/http-proxy/index.js:

var n = r(837)._extend;

This is require('util')._extend, used in the setupOutgoing function to shallow-copy headers.

Code Example

Operating System:
  Platform: linux
  Arch: x86_64
  Version: Ubuntu 24.04 LTS
  Available memory (MB): 8192
  Available CPU cores: 4
Binaries:
  Node: 24.13.1
  npm: 11.4.2
Relevant Packages:
  next: 16.1.6

---

(node:179431) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.

---

var n = r(837)._extend;
RAW_BUFFERClick to expand / collapse

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x86_64
  Version: Ubuntu 24.04 LTS
  Available memory (MB): 8192
  Available CPU cores: 4
Binaries:
  Node: 24.13.1
  npm: 11.4.2
Relevant Packages:
  next: 16.1.6

Which area(s) are affected?

Runtime

Which stage(s) are affected?

next start (production)

Description

Next.js bundles an old version of http-proxy at next/dist/compiled/http-proxy/index.js that uses require('util')._extend, which is deprecated since Node.js v22 (DEP0060).

During production runtime, this produces the following warning:

(node:179431) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.

The offending line in next/dist/compiled/http-proxy/index.js:

var n = r(837)._extend;

This is require('util')._extend, used in the setupOutgoing function to shallow-copy headers.

Expected Behavior

No deprecation warning. The compiled http-proxy bundle should use Object.assign() instead of util._extend.

To Reproduce

  1. Create any Next.js 16 app
  2. Run next build && next start on Node.js 24
  3. Make a request that triggers the http-proxy code path (e.g., API route rewrites)
  4. Observe the DEP0060 warning in stdout

extent analysis

Fix: Patch the bundled http‑proxy to stop using util._extend

Node v22+ throws a DEP0060 warning because the copy of http‑proxy that Next.js ships (under next/dist/compiled/http-proxy) still calls require('util')._extend.
The quickest, production‑safe way is to replace that call with Object.assign after the package is installed, using patch‑package (or a simple post‑install script).

1. Add patch-package to the project

npm i -D patch-package postinstall-postinstall

postinstall-postinstall makes sure the patch runs even when another dependency runs its own post‑install.

2. Create the patch

Run the build once so the compiled file exists, then edit it in‑place:

# open the file in your editor
sed -i 's/var n = r(837)._extend;/var n = Object.assign;/' node_modules/next/dist/compiled/http-proxy/index.js

Now generate a patch:

npx patch-package next

This creates patches/next+16.1.6.patch (or whatever version you have) with the change:

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING