question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Buffer constructor is deprecated (node)

See original GitHub issue

The 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
srchasecommented, Nov 15, 2018

@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.

0reactions
trivikrcommented, Jun 5, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found