chimurai / http-proxy-middleware

:zap: The one-liner node.js http-proxy middleware for connect, express, next.js and more
MIT License
10.79k stars 852 forks source link

Deprecation warnings when using node v22 #1058

Open art-alexeyenko opened 1 week ago

art-alexeyenko commented 1 week ago

Checks

Describe the bug (be clear and concise)

The (node:31680) [DEP0060] DeprecationWarning: Theutil._extendAPI is deprecated. Please use Object.assign() instead warning message occurs when using http-proxy-middleware after upgrading nodejs to version 22.9. The warning originates in http-proxy dependendency:

    at ProxyServer.<anonymous> (...\node_modules\http-proxy\lib\http-proxy\index.js:50:26)
    at HttpProxyMiddleware.middleware (...\node_modules\http-proxy-middleware\dist\http-proxy-middleware.js:23:32)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)

Step-by-step reproduction instructions

1. Update your machine to use the latest version of node (22.9.0 at the time of writing) 
2. Configure an express app to use `http-proxy-middleware` proxy to intercept requests (any requests)
3. Start the app, and trigger a request to be intercepted

The Warning will appear in server logs.

Expected behavior (be clear and concise)

No warning in logs.

How is http-proxy-middleware used in your project?

We intercept API calls to the server endpoint and conditionally modify the response.

What http-proxy-middleware configuration are you using?

createProxyMiddleware({
    // our custom endpoint
    target: graphQLEndpoint.target,
    changeOrigin: true,
    selfHandleResponse: true,
    on: {
      proxyReq: fixRequestBody,
    },
    // our custom plugin
    plugins: [personalizePlugin],
  })

### What OS/version and node/version are you seeing the problem?

```shell
Windows 11
Nodejs 22.9
npm 10.9

Additional context (optional)

No response