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

(node:54764) DeprecationWarning: Using Buffer without new will soon stop working. #1198

Closed
agopshi opened this issue Jan 18, 2017 · 2 comments

Comments

@agopshi
Copy link

agopshi commented Jan 18, 2017

$ node --trace-deprecation baz 
(node:54764) DeprecationWarning: Using Buffer without `new` will soon stop working. Use `new Buffer()`, or preferably `Buffer.from()`, `Buffer.allocUnsafe()` or `Buffer.alloc()` instead.
    at Buffer (buffer.js:79:13)
    at Object.<anonymous> (/Users/foo/node_modules/pg/lib/connection.js:299:19)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/foo/node_modules/pg/lib/client.js:18:18)

The fix is to simply change connection.js:299 from:

var emptyBuffer = Buffer(0);

To:

var emptyBuffer = Buffer.alloc(0);
@vitaly-t
Copy link
Contributor

Yet another duplicate of...

#1195, #1189, #1163 and #1158

Please check the existing issues before reporting a new one.

@agopshi
Copy link
Author

agopshi commented Jan 19, 2017

You are correct. I will exercise more caution in the future. I think I must have had the "is:open" filter on the issue.

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

No branches or pull requests

3 participants