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

Filtering duplicated Unhandled JS Errors doesn't work with obfuscated class names on Android

Open krystofwoldrich opened this issue 2 years ago • 5 comments

Description

Our current solution to avoid duplicated errors being reported to Sentry doesn't work with obfuscated class names as we are checking the exception type against the string JavascriptException.

We have to check this as React Native passes unhandled exceptions from JS layer to the native layers. We catch and send the exception in the JS layer with JS context, the native exception doesn't provide any more useful information.

https://github.com/getsentry/sentry-react-native/blob/0b40c1bc5f73500ffaf1f573bc0b86ded189bbcd/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java#L182-L192

krystofwoldrich avatar Jun 14 '23 14:06 krystofwoldrich

@krystofwoldrich can you actually do instanceof with https://github.com/facebook/react-native/blob/af99a6890b84713d002fbbd872f10fe2e6304861/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/JavascriptException.java#L18 ?

marandaneto avatar Jun 14 '23 14:06 marandaneto

@marandaneto I'm not sure because we are doing the check on the SentryException not on the original Exception. Is there a way to get the original in beforeSend?

krystofwoldrich avatar Jun 15 '23 09:06 krystofwoldrich

@marandaneto I'm not sure because we are doing the check on the SentryException not on the original Exception. Is there a way to get the original in beforeSend?

yes, our docs should document that https://docs.sentry.io/platforms/android/configuration/filtering/

marandaneto avatar Jun 15 '23 09:06 marandaneto

This error doesn't look obfuscated (might be because it was symbolicated by Sentry) but is also reported twice.

krystofwoldrich avatar Jun 16 '23 11:06 krystofwoldrich

Consider even using https://docs.sentry.io/platforms/android/configuration/options/#ignored-exceptions-for-type Maybe probably easier than beforeSend.

marandaneto avatar Jun 16 '23 12:06 marandaneto