Open krishna-cactus opened 1 year ago
Hi, you need to wrap your handler with the Sentry instrumentation as the docs suggest: https://docs.sentry.io/platforms/node/guides/aws-lambda/
The reason is that lambdas freeze execution as soon as a response is sent (i.e. the handler is done/crashed or a response is finished) and our wrapper defers sending a response until the event is flushed.
We don't officially support streamifyResponse
yet so you might need to implement some custom wrapper for your use case.
Thank you for response @Iforst.
Any custom wrapper that you can recommend?
@krishna-cactus You can take inspiration from our own implementation: https://github.com/getsentry/sentry-javascript/blob/61450cb02dde34b59dedeb3cbd44a690c516e9d5/packages/serverless/src/awslambda.ts#L211
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/serverless
SDK Version
7.64.0
Framework Version
No response
Link to Sentry event
No response
SDK Setup
const Sentry = require("@sentry/serverless"); Sentry.AWSLambda.init({ dsn: "https://abc.com/9", tracesSampleRate: 1.0, environment: "test" }); exports.handler = awslambda.streamifyResponse(async (event, responseStream, _context) => { // Code goes here });
Steps to Reproduce
AWS Lambda has provided support for streaming: https://aws.amazon.com/blogs/compute/introducing-aws-lambda-response-streaming/
Automatic capturing all exceptions is not throwing issue notifications while if you use "Sentry.captureException("From KM");" it works.
Expected Result
All unhandled exceptions (for example console.logsssss("abc")) should result in sentry notification.
Actual Result
Only handled exceptions are creating notfications, not unhandled ones.