Skip to content
New issue

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

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

Already on GitHub? # to your account

The util._extend API is deprecated. Please use Object.assign() instead. #1696

Open
kayinortin opened this issue Dec 8, 2024 · 1 comment

Comments

@kayinortin
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch http-proxy@1.18.1 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/http-proxy/lib/http-proxy/index.js b/node_modules/http-proxy/lib/http-proxy/index.js
index 977a4b3..739409c 100644
--- a/node_modules/http-proxy/lib/http-proxy/index.js
+++ b/node_modules/http-proxy/lib/http-proxy/index.js
@@ -1,5 +1,5 @@
 var httpProxy = module.exports,
-    extend    = require('util')._extend,
+    extend    = Object.assign,
     parse_url = require('url').parse,
     EE3       = require('eventemitter3'),
     http      = require('http'),

This issue body was partially generated by patch-package.

@Jimbly
Copy link
Contributor

Jimbly commented Jan 30, 2025

If you're using http-proxy on a version of Node that deprecates Object.assign(), then you've got a huge memory leak (aborted requests not being cleaned up anymore), you may want to use http-proxy-node16 instead (which, coincidentally, also has a fix for this deprecation).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants