sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Linked error are not symbolicated in Debug builds

Open Yupeng-li opened this issue 3 years ago • 9 comments

Environment

How do you use Sentry? Sentry SaaS (sentry.io)

Which SDK and version? @sentry/react-native 3.2.13

Steps to Reproduce

I need to report inner error when throwing exceptions, and LinkedErrors is the solution I found. To link two error, I assigned the inner error to the cause property of the final error.

//....
finalError.cause = innerError
Sentry.captureException(finalError)

When I tested, both the higher level error and the inner error are logged to sentry, however the stack trace was minified. But if I don't link them, the stack trace worked fine, so I think it's a bug. Here is a mini repo to reproduce the issue. https://github.com/Yupeng-li/sentry-test

The repo is a react-native app with two simple buttons: one throws an error and another throws an error with cause property.

Please modify the DSN before running it.

Expected Result

Linked error should have original stack trace.

This is what I got when I reported the error directly. (Throw an error) image

Actual Result

This is what I got when I reported the error with cause. (Throw an error with cause) linked errors

Yupeng-li avatar Mar 07 '22 13:03 Yupeng-li

This integration is within the node package, wondering if that makes any difference. @AbhiPrasad or @kamilogorek do you know what's going on? thanks

marandaneto avatar Mar 07 '22 14:03 marandaneto

This is strange, it seems that RewriteFrames doesn't update the stacktrace here?

https://github.com/getsentry/sentry-react-native/blob/16cfa52fcae796c51d1880b2ad6d9fc73dbede59/src/js/sdk.tsx#L72

Not sure if it's a general SDK bug, or just based on how react native sdk is configuring RewriteFrames, we need to test with a stock browser SDK app that uses LinkedErrors + RewriteFrames.

AbhiPrasad avatar Mar 07 '22 14:03 AbhiPrasad

Thanks @AbhiPrasad Let us know if you find something on your testing.

marandaneto avatar Mar 08 '22 08:03 marandaneto

@Yupeng-li have you tested on a release or debug mode?

I can reproduce the issue on debug mode but not on release mode.

The issue is here -> https://github.com/getsentry/sentry-react-native/blob/main/src/js/integrations/debugsymbolicator.ts We are apparently not accounting for all the exceptions when symbolicating on the device.

marandaneto avatar Mar 23 '22 17:03 marandaneto

That's also the reason why the platform is node sometimes -> https://github.com/getsentry/sentry-react-native/blob/main/src/js/integrations/debugsymbolicator.ts#L78

marandaneto avatar Mar 23 '22 17:03 marandaneto

@marandaneto Thank you for the update. I only tested on debug mode. I will test the release mode as soon as I have a chance.

Yupeng-li avatar Mar 25 '22 16:03 Yupeng-li

Hi @marandaneto, sorry for the late reply. I tested with the release version and it worked well as expected. Thank you for the help.

image

Yupeng-li avatar Apr 13 '22 12:04 Yupeng-li

Based on the last comment is this done?

krystofwoldrich avatar Dec 07 '22 09:12 krystofwoldrich

@krystofwoldrich I believe it's only working for release mode, it's still broken in debug builds, isn't it?

liamjones avatar Dec 07 '22 09:12 liamjones