-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Package: nodeIssues related to the Sentry Node SDKIssues related to the Sentry Node SDK
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.9.2
Framework Version
Hapi 21.3.10
Link to Sentry event
No response
SDK Setup/Reproduction Example
I did some debugging and found that the issue can be fixed by specifying the 'error'
channel here, like this:
server.events.on({name:'request', channels: ['error']}, (request, event) => {
Otherwise, an internal
channel event occurs and that event is apparently too soon in the request lifecycle. I figured this out by comparing with hapi-sentry (code).
I believe this is enough for a minimal reproducible example:
Sentry.init();
Sentry.setupHapiErrorHandler(server);
server.ext('onPreResponse', (response, h) => {
throw Boom.notFound();
});
Steps to Reproduce
- Send a request where the route handler throws an Error
- The onPreResponse hook replaces the error with a Boom error
Expected Result
No error is reported to Sentry since Boom error responses do not generate Hapi response error events. And the error thrown from the handler should not be considered uncaught.
Actual Result
The Error thrown from the handler is reported to Sentry.
eweap
Metadata
Metadata
Assignees
Labels
Package: nodeIssues related to the Sentry Node SDKIssues related to the Sentry Node SDK
Type
Projects
Status
No status