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
tl;dr: our users ran into a 500 that wasn't reported to Sentry! Sentry.Handlers.errorHandler() has some undocumented behavior that caused this.
Our users reported a 500 when they were hitting an API that involved uploading a file to S3. We were confused because Sentry didn't send us a notification. Turns out, the server's IAM role lacked the necessary permissions, so the aws-sdk S3 client threw an error like this:
This means that errorHandler is ignoring errors if they have a statusCode property set to < 500.
This isn't great for a variety of reasons:
It's not documented behavior 😬
@sentry/node shouldn't assume that error properties are explicitly made by the user. In this case, it was aws-sdk's decision to add statusCode as a descriptive attribute.
While it's common for Express developers to make an error handler that handles statusCode elegantly (e.g. raise a 404 if the error has a statusCode of 404), many do not choose to do this because they prefer HTTP codes to be sent explicitly.
I would recommend either:
Making this a configurable option in errorHandler(). Maybe add filterErrors as a parameter:
tl;dr: our users ran into a 500 that wasn't reported to Sentry!
Sentry.Handlers.errorHandler()
has some undocumented behavior that caused this.Our users reported a 500 when they were hitting an API that involved uploading a file to S3. We were confused because Sentry didn't send us a notification. Turns out, the server's IAM role lacked the necessary permissions, so the
aws-sdk
S3 client threw an error like this:After a lot of time spent debugging, we decided to read the
Sentry.Handlers.errorHandler()
source and we discovered:This means that
errorHandler
is ignoring errors if they have astatusCode
property set to < 500.This isn't great for a variety of reasons:
@sentry/node
shouldn't assume that error properties are explicitly made by the user. In this case, it wasaws-sdk
's decision to addstatusCode
as a descriptive attribute.statusCode
elegantly (e.g. raise a 404 if the error has a statusCode of 404), many do not choose to do this because they prefer HTTP codes to be sent explicitly.I would recommend either:
filterErrors
as a parameter:errorHandler
manually. For example:As a temporary patch, we're including code that does this:
The text was updated successfully, but these errors were encountered: