DEP0005 🟩 Node.js

DeprecationWarning: Buffer() is deprecated due to security and usability issues (DEP0005)

Code (yours or a dependency) uses the deprecated new Buffer() constructor.

Seen on: Node.js

Meaning

new Buffer(n) could expose uninitialised memory. Use Buffer.from, Buffer.alloc or Buffer.allocUnsafe.

Common causes

  • Old dependency using new Buffer()
  • Legacy code in your project

⚡ Quick fix

  1. Replace with Buffer.from(string|array) or Buffer.alloc(size)
  2. Upgrade the dependency
  3. Find the source with --trace-deprecation

Detailed fix by platform

Node.js

  1. node --trace-deprecation app.js

How to diagnose

  1. Source — Your code or which package?
  2. Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.