The `util._extend` API is deprecated. Please use Object.assign() instead.
kayinortin opened this issue ยท 3 comments
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.
If you're using http-proxy on a version of Node that deprecates util._extend(), 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).
If you're using
http-proxyon a version of Node that deprecatesObject.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).
I had the same issue, its util._extend that is depricated, not Object.assign. I'm not really sure how this works (as in contributing to repositories like this) but I created a pull request for the changes that fixed the issue for me, very similar to what @kayinortin did.
Sorry, I had a typo in my message, I meant "deprecates util._extend()" of course, as that's what this issue is about (Object.assign is the solution, not the problem). It is already fixed on the (at least slightly maintained) http-proxy-node16 module (along with much bigger issues you'll run into on Node 16+).