getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.97k stars 1.57k forks source link

originalException missing from beforeSend hint when using React ErrorBoundry #3987

Closed robcrocombe closed 3 years ago

robcrocombe commented 3 years ago

Package + Version

Version:

6.12.0

Description

The docs describe a way of filtering events using the hint.originalException object. However using the React library with included ErrorBoundry component the hint object only contains { event_id: 'xxxx' } and no originalException or syntheticException etc.

I've done some digging and I think (not certain, only trying to read the lib code) that this new addition https://github.com/getsentry/sentry-javascript/pull/3532 (React 17 error boundaries) has swallowed the original error. I tried skipping this section of the code and the original exception came back on the hint inside beforeSend.

Please can something be done to restore this functionality, or am I doing something wrong? Thanks

AbhiPrasad commented 3 years ago

Thanks for opening an issue. You're right that we should be propagating the hint here. @kamilogorek what do you think the best way to do this is?

@sentry/minimal's captureEvent doesn't allow us to pass in a hint, should we change the function signature? https://github.com/getsentry/sentry-javascript/blob/master/packages/minimal/src/index.ts#L86

AbhiPrasad commented 3 years ago

Hey @robcrocombe, we've adjusted the Error Boundary so that the hint should be passed down correctly. This is available with SDK v16.3.3.

Please let us know if you have any other feedback or issues. Thanks!

robcrocombe commented 3 years ago

Hey @AbhiPrasad, we've been using this version for a few days and all seems well. Thanks very much for your quick response!