Open jackie-greenbaum opened 7 months ago
This is not ideal, but there's not much we can do because this is the behaviour that Node.js itself expects.
We should evaluate switching to using https://nodejs.org/api/process.html#event-uncaughtexceptionmonitor now that the SDK supports Node 14+ in v8.
Backlogging this for now, but PRs are welcome if you have any ideas for improving this behaviour.
Appreciate the quick response!
Perhaps something should be added to the documentation here if we don't (currently) expect UnhandledRejections
to be reported?
Unless I'm misunderstanding
We should add the workaround of clearing listeners and using Sentry's in the docs - PRs are welcome!
Also experiencing this issue. Any change this can be fixed? or a workaround?
If you point me in the right direction i'd be happy to give it a shot.
For others, currently a template render error in https://github.com/resend/react-email will surface this error and not show up in Sentry.
Hi @Gervwyk, sorry for the late response. The team is at a conference.
The workaround is to call process.removeAllListeners('unhandledRejection');
before you call Sentry.init
. Meaning you can't rely on our auto-patching of the lambda function handler (if you're using our AWS Lambda layer). This means you'll have to manually wrap the handler with Sentry.wrapHandler
, see more details here.
I will add this to the docs, and also investigate if the SDK can switch to uncaughtExceptionMonitor
.
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/aws-serverless
SDK Version
7.84.0
Framework Version
Remix 2.4.0
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
Deploy a lambda function which inits Sentry with default args and then trigger an
UnhandledPromiseRejection
Expected Result
In my AWS Lambda function configured with Sentry, when I trigger an
unhandledRejection
, I expect Sentry to capture that error and create an issue for it.Actual Result
However, in my case it appears as though the Sentry
unhandledRejection
handler is getting clobbered by the handler added by AWS Lambda.Here's a printout of the two handlers that node currently knows about it, the first from AWS and the second from Sentry
As a workaround, we can (before
Sentry.init
) callprocess.removeAllListeners('unhandledRejection');
as suggested by AWS, but this feels like something Sentry should handle or at least warn the user about.