Skip to content
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

Caught/Handled exceptions are always being logged as unhandled (@sentry/serverless) #5408

Closed
3 tasks done
whats-a-handle opened this issue Jul 11, 2022 · 6 comments · Fixed by #9368
Closed
3 tasks done

Comments

@whats-a-handle
Copy link

whats-a-handle commented Jul 11, 2022

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/serverless

SDK Version

7.6.0

Framework Version

7.6.0

Link to Sentry event

https://sentry.io/organizations/kitup-stage/issues/3418028253/events/3127d807ee0e4ba2bda444c287041aad/?project=6521764

Steps to Reproduce

  1. Create a Lambda function and wrap it with the Sentry.AWSLambda.wrapHandler()
  2. Create a try/catch block
  3. In the try block, throw an error
  4. In the catch block, call Sentry.captureException(error) to catch and log the error
  5. Expected behavior is that the handled tag is set to true because the error or exception was caught within the tr/catch and not the wrapHandler. However, the caught error is always flagged as unhandled handled:false

This might be the relevant code according to this Discord discussion in Sentry discord :

export function serverlessEventProcessor(event: Event): Event {
addExceptionMechanism(event, {
handled: false,
});
return event;
}

Expected Result

Errors caught within a try/catch block and logged in the catch statement with Sentry.captureException(error) should be marked as handled:true

Actual Result

Errors caught within the try/catch block are always marked as handled:false.
Screen Shot 2022-07-11 at 2 26 27 PM

@lobsterkatie
Copy link
Member

related: #5375, though that's the opposite problem.

@AbhiPrasad
Copy link
Member

I think we're going to take a look at handled in general - we should write up a new GH issue summarizing all the problems and gather feedback accordingly.

In the meantime, @whats-a-handle appreciate your patience while we engage in some due diligence to make sure we cover all the cases appropriately.

@rtfeldman
Copy link

I know it's been over a year, but I wanted to follow up on this because I just ran into this at work (calling Sentry.captureException in a Node backend and having it arrive in Sentry as "unhandled"). I notice the issue is open but it's had the backlog label removed; is the plan to leave the current behavior as-is?

@AbhiPrasad
Copy link
Member

Opened #9368 to fix this, thanks for the reminder @rtfeldman!

@rtfeldman
Copy link

Awesome, thank you so much! 😃

@AbhiPrasad
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants