-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Unhandled promise rejection causes app to crash with Node requestHandler registered #7000
Comments
Assigning to @getsentry/support for routing, due by Monday, January 30th at 2:03 pm (yyz). ⏲️ |
More details: The app starts an HTTP server which registers Sentry's request handler: With this handler registered, unhandled promise rejection crashes the app. Without the handler registered, the app keeps running and Node prints this text in the console:
The fact that with Sentry the app crashes is IMO a bug. It should work the same as without Sentry. |
Routing to @getsentry/team-web-sdk-frontend for triage, due by Tuesday, January 31st at 2:30 pm (sfo). ⏲️ |
Hi, trying out your example there are a few observations:
IMO only observation 2 from above is problematic and we somehow need to fix. The reason your app is crashing at all is because you're registering an async handler in express which express doesn't support. Read more here: https://expressjs.com/en/advanced/best-practice-performance.html#use-promises |
Good point about it still crashing without Sentry at all, missed that part. But this is minimized case from a Nuxt project where it doesn't crash without Sentry but does with Sentry+request handler. So there might be something more to it that I'd have to check.
The point of this example is to show the difference in how Unhandled Promise rejection is handled with and without Sentry. I know that express doesn't technically support async handlers and it only cares that |
Yeah, the dilemma we face is that we need to attach handlers to Changing this behavior however, is problematic because users already depend on it so we're going to fix it in the next major version of the SDK. We already did something similar not long ago and opaquely broke a bunch of existing users which we would like to avoid. We're tracking this change for the next major here, here and here I will close this issue, since we are aware of this and currently want to keep the issue backlog clean. I hope that's okay. Thanks again for reporting this! |
Environment
self-hosted (https://develop.sentry.dev/self-hosted/)
Version
No response
Link
No response
DSN
No response
Steps to Reproduce
npm i
andnpm run start
Expected Result
The script should keep running after HTTP request finishes.
Actual Result
After the HTTP request finishes, the app crashes.
The text was updated successfully, but these errors were encountered: