You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Only the second error (unhandled error) should be reported.
Actual Result
Both error are reported.
Sentry uses Fastify's onError hooks to catch errors. Fastify documentation states that This hook will be executed only after the Custom Error Handler set by setErrorHandler has been executed, and only if the custom error handler sends an error back to the user (Note that the default error handler always sends the error back to the user).
But undocumented behavior is that errors thrown from other hooks, even if finally sent to the custom error handler, go to onError hook before going the error handler. This cause every error thrown in other hooks to be reported by Sentry even before it can be handled.
The text was updated successfully, but these errors were encountered:
You identified the problem well, awesome - sadly, I think there isn't much we can do there except hope to get this fixed in fastify itself - let's see what folks over there in the issue you opened answer. We can possibly look into contributing a fix ourselves, but we'd need to get into the fastify codebase first as well.
To avoid these being sent. This is of course not ideal because you need to kind of duplicate this logic, but maybe you can also find a way to extract this out into a utility somehow 🤔
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.0.0
Framework Version
4.27.0
Link to Sentry event
No response
SDK Setup
No response
Steps to Reproduce
Expected Result
Only the second error (
unhandled error
) should be reported.Actual Result
Both error are reported.
Sentry uses Fastify's
onError
hooks to catch errors. Fastify documentation states that This hook will be executed only after the Custom Error Handler set by setErrorHandler has been executed, and only if the custom error handler sends an error back to the user (Note that the default error handler always sends the error back to the user).But undocumented behavior is that errors thrown from other hooks, even if finally sent to the custom error handler, go to
onError
hook before going the error handler. This cause every error thrown in other hooks to be reported by Sentry even before it can be handled.The text was updated successfully, but these errors were encountered: