Hey all, I'm getting this deprecated error: ```E...
# help
j
Hey all, I'm getting this deprecated error:
Copy code
ERROR	(node:9) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
This happens because one of my dependencies use the deprecated Buffer (I don't know which dependencies...), and even though this error only shows up if Buffer() is used outside of node_modules, SST bundles my project, meaning my dependencies code is outside of node_modules, hence this error occurs I think. Does anyone else have this problem? Because of this, I'm constantly getting HTTP 500 when I call my API. I'm trying to disable this error but to no avail...
f
Hey @Jack Tan, I didn’t Buffer() deprecation is an ERROR, thought it was a WARNING.
Can you look at the lock file and see which package is including it?
or do a
npm ls
j
Thanks @Frank I'm using
yarn
but I assumed
yarn why buffer
?
aws-lambda
which uses
aws-sdk
which uses
buffer
nodemailer
uses
aws-sdk
which also uses
buffer
Found
aws-sdk@2.1037.0
I thought it's a warning too but I think it use
console.error
. The problem is, when I run SST locally, it return the status code as 200 as seen on the screenshot, then the lambda function disconnected. If I don't run it locally, the only "error" I get is this
Buffer()
deprecated problem as seen here in Cloudwatch
I can't even catch this error inside my
try catch
This is the code that is causing this issue, I don't see anything wrong with it... It's really weird.. Is there a way to run
node *
--pending-deprecation`* ` but for SST?
Okay this is annoying, I added `then(async (response) =>`and the warning is gone...
j
@Frank it’s weird that this warning kills request locally right?
f
hmm I think the issue might not be related to the buffer
Usually the
Failed to send response
error happens when the Lambda request took long to respond, and the actually Lambda function timed out already.
@Jack Tan What are you setting the function timeout to? Can you try increasing it to ie. 20s?
j
I increased the timeout to 20s, still got
Failed to send response
error, even though locally my Lambda returned 200
the error is back 😞
There's no way to add
node --pending-deprecation
? @Frank @Jay
Copy code
a50278bb-47fb-43e3-9614-44e4cb116f77 REQUEST dev-papermind-email-servi-EmailServiceLambdaPOSTem-5tJmN6G4OxxU [src/sendSignatureIsSignedEmail.handler] invoked by API POST /email/signature/send

a50278bb-47fb-43e3-9614-44e4cb116f77 RESPONSE {"statusCode":200,"headers":{"Content-Type":"text/plain","Access-Control-Allow-Origin":"<http://localhost:3000>"},"body":"Signature is signed email sent."}

a50278bb-47fb-43e3-9614-44e4cb116f77-1645583574288 Failed to send response because the Lambda function is disconnected
The response is there.. This is a huge blocker at work atm..
f
Hey @Jack Tan, can you send me ur
.build/sst-debug.log
?
Just leaving a note here. The issue was indeed the Lambda taking long to run. It worked after setting timeout to 30s.