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
- Replace with Buffer.from(string|array) or Buffer.alloc(size)
- Upgrade the dependency
- Find the source with --trace-deprecation
Detailed fix by platform
Node.js
node --trace-deprecation app.js
How to diagnose
- Source — Your code or which package?
- 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026