sentry-react-native: Native crashes are not reported
OS:
- [] Windows
- MacOS
- Linux
Platform:
- iOS
- Android
SDK:
-
@sentry/react-native
(>= 1.0.0) -
react-native-sentry
(<= 0.43.2)
SDK version: 2.1.0
react-native
version: 0.63.3
Are you using Expo?
- Yes
- No
Are you using sentry.io or on-premise?
- sentry.io (SaaS)
- on-premise
If you are using sentry.io, please post a link to your issue so we can take a look:
[Link to issue]
Configuration:
(@sentry/react-native
)
Sentry.init({
dsn: 'https://...@sentry.io/...'
enableAutoSessionTracking: true,
});
I have following issue:
Crashes are not reported nor in production nor if they are forced with Sentry.nativeCrash();
Steps to reproduce: none
Actual result:
All exceptions are correctly handled but crashes
Expected result:
Crashes should also be reported
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 32 (16 by maintainers)
Update: I tried a fresh re-install again, this time with version 2.6.0 and I see those native iOS crashes in Sentry! 🎉 The only issue I noticed is that values set on the scope don’t come through for native crashes. I set the user id on the javascript side like this:
Sentry.setUser({ id: userID })
But there is a difference between native errors / js errors:Sentry.nativeCrash()
- Missing expected user idthrow new Error('Test crash: JavaScript')
- User id is present and correct Both these methods are called after Sentry.init & Sentry.setUser.@jennmueng I am having the same issue.
@dprevost-LMI In debug mode React Native captures the crash and displays it in the RedBox for developers’ convenience therefore Sentry doesn’t capture the crash because the app keeps running.
As you mentioned the crashes are correctly reported in Release builds.
FYI: For me, when in debug mode, native crashes were never reported, but when using a version built in release mode, there were. Not sure why!
I was running into this issue as well. Turns out I needed to remove the Sentry.nativeCrash() and reload the app in a working state for it to be logged on the sentry conslole. IMO this isn’t ideal because I still want to see a crash if a user decides not to go back in but it still works.
@jennmueng definitely not a dumb question. After lots of fresh installs and toying around with it, I was able to get 2.6.0 working…not sure what exactly got it to work and don’t have time to try to recreate it. Thanks!