webpack-dev-server icon indicating copy to clipboard operation
webpack-dev-server copied to clipboard

Deprecation warning for http-proxy 'util._extend'

Open Torquin opened this issue 1 year ago • 9 comments

Bug report

Deprecation warning for dependency http-proxy 1.18.1

Actual Behavior

When using npm start script, I get a warning : The 'util._extend' API is deprecated. Please use Object.assing() instead.

How Do We Reproduce?

Using the node --trace-deprecation in start script, it directs to : node_modules/http-proxy/lib/http-proxy/index.js

Results of npx webpack-cli info

System: OS: Linux 4.18 Rocky Linux 8.10 (Green Obsidian) CPU: (12) x64 Intel(R) Core(TM) i7-10710U CPU @ 1.10GHz Memory: 10.02 GB / 31.11 GB Binaries: Node: 22.8.0 - ~/.nvm/versions/node/v22.8.0/bin/node npm: 10.8.2 - ~/.nvm/versions/node/v22.8.0/bin/npm Browsers: Brave Browser: 128.1.69.168 Chrome: 130.0.6710.0 Packages: angular-router-loader: ^0.8.5 => 0.8.5 babel-loader: ^9.1.0 => 9.2.1 compression-webpack-plugin: ^11.1.0 => 11.1.0 copy-webpack-plugin: ^12.0.2 => 12.0.2 css-loader: ^7.1.2 => 7.1.2 css-minimizer-webpack-plugin: ^7.0.0 => 7.0.0 css-to-string-loader: github:ekopranototjoa/css-to-string-loader => 0.1.3 eslint-webpack-plugin: ^4.0.1 => 4.2.0 extract-loader: ^5.1.0 => 5.1.0 file-loader: ^6.0.0 => 6.2.0 html-loader: ^5.1.0 => 5.1.0 html-webpack-plugin: ^5.6 => 5.6.0 json-loader: ^0.5.3 => 0.5.7 null-loader: ^4.0.0 => 4.0.1 postcss-loader: ^8.1.1 => 8.1.1 style-loader: ^4.0.0 => 4.0.0 url-loader: ^4.1.0 => 4.1.1 webpack: ^5.89.0 => 5.94.0 webpack-cli: ^5.1.4 => 5.1.4 webpack-dev-server: ^5.1.0 => 5.1.0 webpack-merge: ^6.0.1 => 6.0.1

Torquin avatar Sep 25 '24 09:09 Torquin

http-proxy-middleware was updated. They have a migration guide.

joemaller avatar Oct 22 '24 00:10 joemaller

Hey I am Interested in this issue, How to get started

Anubhab2003 avatar Jan 03 '25 07:01 Anubhab2003

http-proxy-middleware was updated. They have a migration guide.

As they mention in this issue, the problem comes from http-proxy (#1674), which is not maintained anymore and hasn't been updated for 4 years. But as mentioned, the vite team has decided for a patch.

So @Anubhab2003 maybe using pnpm or patch-package is a suitable solution in the mean time.

davidenke avatar Mar 20 '25 13:03 davidenke

We will update http-proxy for the next major release, just ignore it now, because it doesn't breaking anything

alexander-akait avatar Mar 22 '25 14:03 alexander-akait

We will update http-proxy for the next major release, just ignore it now, because it doesn't breaking anything

The package hasn't been updated in 4 years and is searching for maintainers. Others decided for a patch. Just mentioning.

davidenke avatar Mar 23 '25 08:03 davidenke

@davidenke If you wan't to send a patch - feel free to send a PR

alexander-akait avatar Mar 24 '25 17:03 alexander-akait

@davidenke If you wan't to send a patch - feel free to send a PR

Sure. ~~But it's still a unmaintained dependency then~~. There already is a PR addressing this, but there hasn't been a release in 5 years.

Maybe it would make sense to pin the commit containing the relevant change in the mean while?

davidenke avatar Mar 27 '25 08:03 davidenke

@davidenke

Maybe it would make sense to pin the commit containing the relevant change in the mean while?

What do you mean?

alexander-akait avatar Mar 27 '25 11:03 alexander-akait

@alexander-akait I mean setting http-proxy as dependency explicitly by pinning the commit in the PR in the package.json.

Alternatives

Patching would mean to introduce tooling and thus new dependencies like patch-package.

Searching for an alternative to http-proxy-middleware, which perhaps would lead to breaking changes.

Or just waiting for new maintainers for http-proxy, or that the http-proxy-middleware authors come up with an alternative.

davidenke avatar Mar 29 '25 12:03 davidenke

Seems, that problem is in the spdy package. It has several lines util._extend() in the source code. spdy already is not supported (last commit was 5 years ago, no reaction on issues) and this issue will never be fixed. Do we really need this package, why not just use standard features?

zdm avatar Aug 10 '25 05:08 zdm

Vite seems to have switched to http-proxy-3, see here. Might be worth to switch too?

Netail avatar Aug 15 '25 08:08 Netail

spdy will be removed in the next major release

alexander-akait avatar Aug 15 '25 12:08 alexander-akait

We don't use http-proxy directly, we use http-proxy-middleware, make sense to open an issue in https://github.com/chimurai/http-proxy-middleware/ and ask them to switch another package

alexander-akait avatar Aug 15 '25 13:08 alexander-akait

Created an issue to migrate to http-proxy-3: https://github.com/chimurai/http-proxy-middleware/issues/1136

chimurai avatar Sep 13 '25 16:09 chimurai