Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Deprecation warning for util._extend #1017

Closed
2 tasks done
TheJaredWilcurt opened this issue Jul 9, 2024 · 11 comments
Closed
2 tasks done

Deprecation warning for util._extend #1017

TheJaredWilcurt opened this issue Jul 9, 2024 · 11 comments
Labels

Comments

@TheJaredWilcurt
Copy link

TheJaredWilcurt commented Jul 9, 2024

Checks

Describe the bug (be clear and concise)

In Node v22 they started showing a deprecation warning for usage of util._extend, which is used in a dependency of this library.

(node:27864) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
    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:22:32)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

There is a PR for that dependency:

Once that is merged and a new version is released, http-proxy-middleware will need to update the dependency to stop receiving the deprecation warning in Node v22+.

I'm mainly making this issue to encourage prioritization of the linked PR.

Step-by-step reproduction instructions

1. Use library with Node 22+

Expected behavior (be clear and concise)

No deprecation warnings

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

internal-app@1.0.0 C:\internal-app
`-- @internal-library/utils-ui-dev@3.1.1
  `-- http-proxy-middleware@3.0.0.2 deduped
| +-- istanbul-reports@3.1.7

What http-proxy-middleware configuration are you using?

N/A

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

Node v22.3.0 - All OS

Additional context (optional)

No response

@chimurai
Copy link
Owner

chimurai commented Jul 12, 2024

Thanks for the report.

With semver, when http-proxy releases a new minor of patch version, there is no need to update this project.

You can just update your package lock file to retrieve updated http-proxy dependency.

"http-proxy": "^1.18.1",

Closing this issue
(since no update to http-proxy-middleware is needed when http-proxy releases a minor/patch update)

You can read more about semver: https://semver.org

@habahabahaba
Copy link

Hello. I am getting "Deprecation warning for util._extend", when using http-proxy-middleware with Express.
My code:

// 3rd party:
import { createProxyMiddleware } from 'http-proxy-middleware';
// Express:
import express from 'express';

export function serve(
  port: number,
  filename: string,
  dir: string
): Promise<void> {
  const app = express();

  app.use(
    createProxyMiddleware({
      target: `http://localhost:5173`,
      ws: true,
    })
  );

  return new Promise<void>((resolve, reject) => {
    app.listen(port, resolve).on('error', reject);
  });
}

My package.json:

{
  "version": "1.0.0",
  "description": "",
  "main": "dist/index.js",
  "types": "dist/index.d.ts",
  "type": "module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "tsc --watch --preserveWatchOutput"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@types/cors": "^2.8.17",
    "@types/express": "^4.17.21",
    "cors": "^2.8.5",
    "express": "^4.19.2",
    "http-proxy-middleware": "^3.0.0"
  }
}

My error:

(node:26057) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
    at ProxyServer.<anonymous> (.../node_modules/.pnpm/http-proxy@1.18.1_debug@4.3.5/node_modules/http-proxy/lib/http-proxy/index.js:50:26)
    at HttpProxyMiddleware.middleware (.../node_modules/.pnpm/http-proxy-middleware@3.0.0/node_modules/http-proxy-middleware/dist/http-proxy-middleware.js:22:32)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

@btkfrank
Copy link

Thanks for the report.

With semver, when http-proxy releases a new minor of patch version, there is no need to update this project.

You can just update your package lock file to retrieve updated http-proxy dependency.

"http-proxy": "^1.18.1",

Closing this issue (since no update to http-proxy-middleware is needed when http-proxy releases a minor/patch update)

You can read more about semver: https://semver.org

http-proxy@1.18.1 is already the latest version, and hasn't been updated for 4 years. And is still using util._extend

@Netail
Copy link

Netail commented Aug 16, 2024

@chimurai please reopen this issue again. Facing the same deprecation warning with the lastest version :/

@chabb
Copy link

chabb commented Aug 20, 2024

@chimurai You can take a look at the vitejs repo. They patched the http-proxy package to solve this issue : vitejs/vite#16655

@baur

This comment was marked as spam.

@Auios
Copy link

Auios commented Nov 23, 2024

Getting this issue too.

[backend] (node:21880) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
[backend]     at ProxyServer.<anonymous> (C:\GitHub\AppThing\node_modules\http-proxy\lib\http-proxy\index.js:50:26)
[backend]     at HttpProxyMiddleware.middleware (C:\GitHub\AppThing\node_modules\http-proxy-middleware\dist\http-proxy-middleware.js:23:32)
[backend]     at processTicksAndRejections (node:internal/process/task_queues:105:5)

@cami-dev
Copy link

cami-dev commented Dec 6, 2024

Why was this closed? This is still an issue. You have a dead dependency then called http-proxy which haven't been updated in 5 years. So there wont be any update there. Please replace your dependency to them and fix this issue. Getting this since angular uses http-proxy-middleware as a dependency so can't really be fixed elsewhere. Please reopen.

Having the same issue with node 22.11.0

@cami-dev
Copy link

cami-dev commented Dec 6, 2024

There seem to be something in the work here http-party/node-http-proxy#1666 at http-proxy but ye still no release for those tracking this issue .

@Netail
Copy link

Netail commented Jan 2, 2025

Yeah I doubt there will be an updating coming in node-http-proxy any time soon... Best to switch to a fork, write a patch or switch a proxy implementation dependency

@cami-dev
Copy link

cami-dev commented Jan 7, 2025

@chimurai see above comments please.

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

No branches or pull requests

9 participants