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

Remaining Buffer() DeprecationWarning #245

Open
igal1c0de4n opened this issue Apr 24, 2022 · 0 comments
Open

Remaining Buffer() DeprecationWarning #245

igal1c0de4n opened this issue Apr 24, 2022 · 0 comments

Comments

@igal1c0de4n
Copy link

igal1c0de4n commented Apr 24, 2022

Similar to: #242

On [email protected] :
When I upload a file, I see this server-side console warning:

(node:41836) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
    at showFlaggedDeprecation (buffer.js:198:11)
    at Buffer (buffer.js:282:3)
    at Slingshot.StoragePolicy.stringify (packages/edgee_slingshot.js:574:14)
    at Object.applySignature (packages/edgee_slingshot.js:759:44)
    at Object.upload (packages/edgee_slingshot.js:717:10)
    at Slingshot.Directive.getInstructions (packages/edgee_slingshot.js:364:46)
    at MethodInvocation.slingshot/uploadRequest (packages/edgee_slingshot.js:446:22)
    at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1885:12)
    at packages/ddp-server/livedata_server.js:769:19
    at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)
    at packages/ddp-server/livedata_server.js:767:46
    at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)
    at packages/ddp-server/livedata_server.js:765:46
    at new Promise (<anonymous>)
    at Session.method (packages/ddp-server/livedata_server.js:739:23)
    at packages/ddp-server/livedata_server.js:603:43

The error originates at the server side stringify:

    stringify: function (encoding) {                                             // 102
      /* global Buffer: false */                                                 // 103
      return Buffer(JSON.stringify(policy), "utf-8")                             // 104
        .toString(encoding || "base64");                                         // 105
    }                                                                            // 106
  1. As suggested, replacing Buffer(...) with Buffer.from(...) should take care of it
  2. It makes sense to also replace the other two Buffer(...) calls
@igal1c0de4n igal1c0de4n changed the title Remaining Buffer associated DeprecationWarning Remaining Buffer() DeprecationWarning Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant