Describe your issue here
Using crashlytics().crash()
to test the crashlytics works as expect. Before upgrading the libs version, it works fine. After upgrading, not able to get iOS crash issue in firebase console.
Have two buttons (as Javascript section) for testing, the first one uses crashlytics().crash()
to make app crash, the second one throws js error to make the app crash. The first one can crash the app, but not able to get the issue reported in firebase console. The second one can crash the app, can get the issue reported in firebase console.
Steps:
Before upgrade the versions of libs, everything works fine, and didn't change any code after upgrading versions.
Click To Expand
<Button title="Test Crash" onPress={() => {
crashlytics().log("Testing crash");
crashlytics().crash();
}} />
<Button title="Throw JS errors" onPress={() => {
throw XXXError("Manual Error for testing crash", "testing-crash-code");
}} />
#### `package.json`:
# N/A
"@react-native-firebase/app": "^8.4.5",
"@react-native-firebase/crashlytics": "^8.4.9",
"@react-native-firebase/remote-config": "^9.0.10",
// before upgrade the versions are:
"@react-native-firebase/app": "^6.4.0",
"@react-native-firebase/crashlytics": "^6.4.0",
"@react-native-firebase/remote-config": "^6.4.0",
#### `firebase.json` for react-native-firebase v6:
# N/A
"react-native": {
"crashlytics_debug_enabled": true,
"crashlytics_auto_collection_enabled": true
}
### iOS
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:
# N/A
#### `AppDelegate.m`:
// N/A
[FIRApp configure];
Click To Expand
#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`:
// N/A
#### `android/app/build.gradle`:
// N/A
#### `android/settings.gradle`:
// N/A
#### `MainApplication.java`:
// N/A
#### `AndroidManifest.xml`:
<!-- N/A -->
iPhone XR (iOS 14.0.0 (18A373))
Click To Expand
**`react-native info` output:**
OUTPUT GOES HERE
- **Platform that you're experiencing the issue on**:
- [x] iOS
- [ ] Android
- [ ] **iOS** but have not tested behavior on Android
- [ ] **Android** but have not tested behavior on iOS
- [ ] Both
- **`react-native-firebase` version you're using that has this issue:**
- `e.g. 5.4.3`
- **`Firebase` module(s) you're using that has the issue:**
- `e.g. Instance ID`
- **Are you using `TypeScript`?**
- `Y` & `3.7.5`
React Native Firebase
and Invertase
on Twitter for updates on the library.Likely duplicate #4229
Thanks for your reply, but I have tried adding crashlytics_disable_auto_disabler
in firebase.json, it still only Throw JS errors
can collect the crash report, crashlytics().crash()
still not work.
{
"react-native": {
"crashlytics_debug_enabled": true,
"crashlytics_auto_collection_enabled": true,
"crashlytics_disable_auto_disabler": true,
}
}
I downgrade crashlytics version to v8.3.0
"@react-native-firebase/app": "8.3.0",
"@react-native-firebase/crashlytics": "8.3.0",
now Throw JS errors
can NOT collect the crash report, but crashlytics().crash()
works.
checked the source code for crashlytics().crash().
Found that:
v8.3.0 using assert(NO)
to crash the app, (https://github.com/invertase/react-native-firebase/commit/6b136c3972eb25ad37b4d6230e1d6e139c094f86#diff-c743530092161239e6a245403c2a4fff)
v8.4.9 using @throw NSInternalInconsistencyException;
(https://github.com/invertase/react-native-firebase/commit/2cbab5cf91f4e8542c30a237637d071c14bbcde5#diff-c743530092161239e6a245403c2a4fff)
Not sure whether this will impact the logs.
I am also facing the same issue, after upgrading from fabric to firebase @react-native-firebase/crashlytics
And can you please explain where can I add firebase.json?
Thanks in Advance
Ramesh.
I also have the issue. However, I didn't upgrade it. It's the first time.
Packages;
"@react-native-firebase/analytics": "7.6.8",
"@react-native-firebase/app": "8.4.6",
"@react-native-firebase/crashlytics": "^8.4.10",
"@react-native-firebase/messaging": "7.9.1",
@bsonmez interesting, do you have any troubleshooting or bisect information to add to move the issue forward?
@bsonmez interesting, do you have any troubleshooting or bisect information to add to move the issue forward?
Hey @mikehardy, I hope you are all good :)
Sure.
Installation
App,
analytics
, and messaging
packages were already installed and then I add Crashlytics
by using yarn
. Before adding it, all packages were in 7.0.1
, so I had to upgrade them to the versions above. Then I followed, pod install
and they were dependency issues, So I deleted Podfile.lock and restarted again. Successfully installed the packages and built the app.
Also created firebase.json like below
{
"react-native": {
"crashlytics_debug_enabled": true,
"crashlytics_auto_collection_enabled": true,
"crashlytics_disable_auto_disabler": true,
}
}
Usage
I did everything the guide mentions. Tested crashlytics().crash()
both on iOS and Android and successfully worked. However, I didn't see any logs on Firebase Console for iOS. It worked for Android perfectly. I have received logs and user properties. But for iOS didn't show me any Issues, but I guess Crash-free statistics go down a little. I'm not sure about this, but it looked that it decreased a little. I continued tested on iOS by using crash(), It started to go down, but no issues are shown.
Please let me know if I can do anything more.
We think the current crash native code in ios is a problem. There's another version posted here I think? If you swapped it in you'd probably see the trace in the console. You're probably collecting real crashes outside the test function as well
We think the current crash native code in ios is a problem. There's another version posted here I think? If you swapped it in you'd probably see the trace in the console. You're probably collecting real crashes outside the test function as well
Which version should I downgrade to?
We think the current crash native code in ios is a problem. There's another version posted here I think? If you swapped it in you'd probably see the trace in the console. You're probably collecting real crashes outside the test function as well
I did roll back everything to 7.0.1
. Then, added Crashlytics 7.0.1
, I received a crash report in the console. Probably you are right, there must be an issue in the native crash code.
@bsonmez rolling back isn't a great strategy (but understandable as something to try of course)
I'd roll forward but with the patch to the crash code at this exact line https://github.com/invertase/react-native-firebase/blob/b7af3e510907faced401cdf54a3f5542420daadf/packages/crashlytics/ios/RNFBCrashlytics/RNFBCrashlyticsModule.m#L59 from current stable version (not downgraded) to be this exact code
NSException* myException = [NSException
exceptionWithName: NSInternalInconsistencyException
reason:@"V8.4.9 NSInternalInconsistencyException"
userInfo:nil];
@throw myException;
Then use patch-package https://github.com/ds300/patch-package to make it persistent in your project
Even better - @bsonmez if you report success with test crashes using that, you can make a PR (or we can) that fixes it and we'll knock out one of the major frustrations for new RNFB integrators at the moment
I'd roll forward but with the patch to the crash code at this exact line
...
@mikehardy I just tested the steps you described, updating RNFBCrashlyticsModule.m
running patch-package
and it worked for me. I had to create a release build for the crash to be fatal, otherwise the red box captured the error. It took about 40 minutes to show up on the console. The firebase console complained that I had not added the dSYM but did eventually just display the error
Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x1ac849114 __exceptionPreprocess
1 libobjc.A.dylib 0x1c006fcb4 objc_exception_throw
2 app 0x100ba956c +[RNFBCrashlyticsModule __rct_export__672] + 67 (RNFBCrashlyticsModule.m:67)
3 CoreFoundation 0x1ac84d870 __invoking___
4 CoreFoundation 0x1ac730fd0 -[NSInvocation invoke]
5 CoreFoundation 0x1ac731530 -[NSInvocation invokeWithTarget:]
6 app 0x100c31e38 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 587 (RCTModuleMethod.mm:587)
7 app 0x100c33fcc facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&) + 114 (RCTNativeModule.mm:114)
8 app 0x100c33d30 invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) + 404 (Optional.h:404)
9 libdispatch.dylib 0x1ac481298 _dispatch_call_block_and_release
10 libdispatch.dylib 0x1ac482280 _dispatch_client_callout
11 libdispatch.dylib 0x1ac45e4fc _dispatch_lane_serial_drain$VARIANT$armv81
12 libdispatch.dylib 0x1ac45efe8 _dispatch_lane_invoke$VARIANT$armv81
13 libdispatch.dylib 0x1ac468808 _dispatch_workloop_worker_thread
14 libsystem_pthread.dylib 0x1f212c5a4 _pthread_wqthread
15 libsystem_pthread.dylib 0x1f212f874 start_wqthread
Crashed: com.google.firebase.crashlytics.ios.exception
0 app 0x100b08040 FIRCLSProcessRecordAllThreads + 180
1 app 0x100b08424 FIRCLSProcessRecordAllThreads + 423 (FIRCLSProcess.c:423)
2 app 0x100afec7c FIRCLSHandler + 48
3 app 0x100afa904 __FIRCLSExceptionRecord_block_invoke + 218 (FIRCLSException.mm:218)
4 libdispatch.dylib 0x1ac482280 _dispatch_client_callout + 16
5 libdispatch.dylib 0x1ac4650f4 _dispatch_lane_barrier_sync_invoke_and_complete + 56
6 app 0x100afa09c FIRCLSExceptionRecord + 225 (FIRCLSException.mm:225)
7 app 0x100afa394 FIRCLSExceptionRecordNSException + 111 (FIRCLSException.mm:111)
8 app 0x100af9c7c FIRCLSTerminateHandler() + 279 (FIRCLSException.mm:279)
9 libc++abi.dylib 0x1c016b154 std::__terminate(void (*)()) + 16
10 libc++abi.dylib 0x1c016b0ec std::terminate() + 44
11 libobjc.A.dylib 0x1c006fee8 _objc_terminate() + 10
12 libdispatch.dylib 0x1ac482294 _dispatch_client_callout + 36
13 libdispatch.dylib 0x1ac45e4fc _dispatch_lane_serial_drain$VARIANT$armv81 + 568
14 libdispatch.dylib 0x1ac45efe8 _dispatch_lane_invoke$VARIANT$armv81 + 404
15 libdispatch.dylib 0x1ac468808 _dispatch_workloop_worker_thread + 692
16 libsystem_pthread.dylib 0x1f212c5a4 _pthread_wqthread + 272
17 libsystem_pthread.dylib 0x1f212f874 start_wqthread + 8
// firebase.json
{
"react-native": {
"crashlytics_debug_enabled": true,
"crashlytics_disable_auto_disabler": true,
"crashlytics_auto_collection_enabled": true
}
}
//package.json
{
"@react-native-firebase/analytics": "^7.6.7",
"@react-native-firebase/app": "^8.4.5",
"@react-native-firebase/crashlytics": "^8.4.9"
}
```
Thank you so much for testing that! I suppose that's better than nothing that it worked in release but:
I had to create a release build for the crash to be fatal, otherwise the red box captured the error.
This is not a great user experience, the red box power is too strong ;-). Looking for something that works in debug as well ideally, but I think this at minimum is an improvement, but the whole reason for the change from the previous (which was a crashingly-bad-on-purpose array dereference is because we were going for a crash the redbox wouldn't crash. Haven't found the perfect combination yet
I just did some quick research, I wonder if in our crash function we shouldn't just explicitly break the react-native error handling chain by removing whatever error handlers exist except crashlytics, then do the crash. I mean, if you call that method you asked for a crash, it's not evil to do so though this might be the only time that's correct
Inspiration for the thought: https://stackoverflow.com/questions/30918349/how-to-catch-uncaught-exception-globally-in-react-native (basically the reverse of this - finding however redbox catches things and unhooking it)
I'd roll forward but with the patch to the crash code at this exact line
...@mikehardy I just tested the steps you described, updating
RNFBCrashlyticsModule.m
runningpatch-package
and it worked for me. I had to create a release build for the crash to be fatal, otherwise the red box captured the error. It took about 40 minutes to show up on the console. The firebase console complained that I had not added the dSYM but did eventually just display the errorFatal Exception: NSInternalInconsistencyException 0 CoreFoundation 0x1ac849114 __exceptionPreprocess 1 libobjc.A.dylib 0x1c006fcb4 objc_exception_throw 2 app 0x100ba956c +[RNFBCrashlyticsModule __rct_export__672] + 67 (RNFBCrashlyticsModule.m:67) 3 CoreFoundation 0x1ac84d870 __invoking___ 4 CoreFoundation 0x1ac730fd0 -[NSInvocation invoke] 5 CoreFoundation 0x1ac731530 -[NSInvocation invokeWithTarget:] 6 app 0x100c31e38 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 587 (RCTModuleMethod.mm:587) 7 app 0x100c33fcc facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&) + 114 (RCTNativeModule.mm:114) 8 app 0x100c33d30 invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) + 404 (Optional.h:404) 9 libdispatch.dylib 0x1ac481298 _dispatch_call_block_and_release 10 libdispatch.dylib 0x1ac482280 _dispatch_client_callout 11 libdispatch.dylib 0x1ac45e4fc _dispatch_lane_serial_drain$VARIANT$armv81 12 libdispatch.dylib 0x1ac45efe8 _dispatch_lane_invoke$VARIANT$armv81 13 libdispatch.dylib 0x1ac468808 _dispatch_workloop_worker_thread 14 libsystem_pthread.dylib 0x1f212c5a4 _pthread_wqthread 15 libsystem_pthread.dylib 0x1f212f874 start_wqthread Crashed: com.google.firebase.crashlytics.ios.exception 0 app 0x100b08040 FIRCLSProcessRecordAllThreads + 180 1 app 0x100b08424 FIRCLSProcessRecordAllThreads + 423 (FIRCLSProcess.c:423) 2 app 0x100afec7c FIRCLSHandler + 48 3 app 0x100afa904 __FIRCLSExceptionRecord_block_invoke + 218 (FIRCLSException.mm:218) 4 libdispatch.dylib 0x1ac482280 _dispatch_client_callout + 16 5 libdispatch.dylib 0x1ac4650f4 _dispatch_lane_barrier_sync_invoke_and_complete + 56 6 app 0x100afa09c FIRCLSExceptionRecord + 225 (FIRCLSException.mm:225) 7 app 0x100afa394 FIRCLSExceptionRecordNSException + 111 (FIRCLSException.mm:111) 8 app 0x100af9c7c FIRCLSTerminateHandler() + 279 (FIRCLSException.mm:279) 9 libc++abi.dylib 0x1c016b154 std::__terminate(void (*)()) + 16 10 libc++abi.dylib 0x1c016b0ec std::terminate() + 44 11 libobjc.A.dylib 0x1c006fee8 _objc_terminate() + 10 12 libdispatch.dylib 0x1ac482294 _dispatch_client_callout + 36 13 libdispatch.dylib 0x1ac45e4fc _dispatch_lane_serial_drain$VARIANT$armv81 + 568 14 libdispatch.dylib 0x1ac45efe8 _dispatch_lane_invoke$VARIANT$armv81 + 404 15 libdispatch.dylib 0x1ac468808 _dispatch_workloop_worker_thread + 692 16 libsystem_pthread.dylib 0x1f212c5a4 _pthread_wqthread + 272 17 libsystem_pthread.dylib 0x1f212f874 start_wqthread + 8
// firebase.json
{
"react-native": {
"crashlytics_debug_enabled": true,
"crashlytics_disable_auto_disabler": true,
"crashlytics_auto_collection_enabled": true
}
}
//package.json
{
"@react-native-firebase/analytics": "^7.6.7",
"@react-native-firebase/app": "^8.4.5",
"@react-native-firebase/crashlytics": "^8.4.9"
}
@mikehardy @brien-crean
I was also testing yesterday. I did work exactly you mention, and it crashed with the Red box, and firebase didn't show me the detailed records because of the lack of a dSYM file. After upload, I still try to figure out how to see a detailed crash report; that's why I couldn't be sure if it works properly or not.
Just merged in a solution taken from Sentry's test crash function in #4426 by @RyogaK - releasing in the next few minutes, should solve this
Thanks for that @mikehardy
However I just tested, the error is no longer captured by the red box but unfortunately the app still needed to be in a release scheme in Xcode before it would report the crash to the firebase console. Not the end of the world for me as long as release mode errors are captured by the firebase console
@brien-crean
Crashlytics will send error reports when next launch the app after crash. Did you try the following flow?
@RyogaK Yes I tried those steps. I also added a log crashlytics().log('descriptive message')
before the call to crashlytics().crash()
with a different message each time and changed the build number in my Info.plist so I knew which crash I was looking at in the console. I waited an hour each time. The debug crashes never showed up at all. Release crashes showed within minutes.
@brien-crean Hmm, the problem that there is a case of crashlytics will not report although crashed correctly has different cause from this issue I guess. I think better to make new issue.
@mikehardy Thank you Mike.
@brien-crean @RyogaK I started receiving a full report for each crash with logs on the dashboard with the new update. Before, didn't receive any report most of the time but was showing crash count in dSYMs.
This works for me
firebase.json
{
"react-native": {
"crashlytics_debug_enabled": true,
"crashlytics_disable_auto_disabler": true,
"crashlytics_auto_collection_enabled": true
}
}
package.json
{
"@react-native-firebase/analytics": "^7.6.8",
"@react-native-firebase/app": "^8.4.6",
"@react-native-firebase/crashlytics": "^8.4.11",
}
Info.plist
<key>FIREBASE_ANALYTICS_COLLECTION_ENABLED</key>
<true/>
<key>FirebaseCrashlyticsCollectionEnabled</key>
<true/>
Most helpful comment
This works for me
firebase.json
{
"react-native": {
"crashlytics_debug_enabled": true,
"crashlytics_disable_auto_disabler": true,
"crashlytics_auto_collection_enabled": true
}
}
package.json
{
"@react-native-firebase/analytics": "^7.6.8",
"@react-native-firebase/app": "^8.4.6",
"@react-native-firebase/crashlytics": "^8.4.11",
}
Info.plist

<key>FIREBASE_ANALYTICS_COLLECTION_ENABLED</key> <true/> <key>FirebaseCrashlyticsCollectionEnabled</key> <true/>