Buffer constructor is deprecated (node)
See original GitHub issueThe use of the Buffer
constructor is deprecated in versions of Node > 4, but it’s still widely used in this package.
Using certain parts of this package now emits this warning (I believe starting with Node ≥ 10):
[DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
A workaround I now use is:
// Override Buffer assignment in aws-sdk/lib/node_loader.js
require('aws-sdk')
const util = require('aws-sdk/lib/util')
util.Buffer = require('some-buffer-implementation').Buffer
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Porting to the Buffer.from() / Buffer.alloc() API - Node.js
The Buffer() constructor has been deprecated for a while. Is this really an issue? Surveys of code in the npm ecosystem have shown...
Read more >Buffer() is deprecated due to security and usability issues ...
The use of the deprecated new Buffer() constructor (i.E. as used by Yarn) can cause deprecation warnings. Therefore one should NOT use the ......
Read more >Understanding the Buffer Deprecation in Node.js 10
There was previously an attempt to deprecate the Buffer constructor in Node.js with the release of Node.js v6 in 2016. This update introduced...
Read more >Deprecation of Node.js Buffer constructor | by Rich Trott
It is deprecated in the documentation. Starting with Node.js 10.0.0, a runtime warning will be emitted on the first use of Buffer() in...
Read more >Avoid using Buffer deprecated APIs | CAST Appmarq
Using deprecated Node.js API could lead to security compliancy issues. The Buffer() function and new Buffer() constructor are deprecated due to API ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hongaar
Thanks for opening this issue.
Buffer() is required for compatibility support, but this is something we’re looking to address in the next major version of the SDK.
Since you’re using a newer version Node, this is a good solution to use a different implementation.
Locking this thread as deprecated buffer constructor was removed in #2687, and the fix was released in v2.467.0 Please open a new issue for related bugs and link to relevant comments in this thread.