invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.63k stars 2.2k forks source link

[RESOLVED we think] 🔥 Crashlytics 8.0.1 not collecting on iOS #3879

Closed elledienne closed 4 years ago

elledienne commented 4 years ago

Issue

In the latest version of Crashlytics, in iOS, the automatic collection of data is disabled by default - even though it's not specified in the documentation - and there is no way (as far as I can see) to enable it beside using the property crashlytics_disable_auto_disabler, which is available in but undocumented (# config.crashlytics_disable_auto_disabler - undocumented for now - mainly for debugging, document if becomes usful, line https://github.com/invertase/react-native-firebase/pull/3580/files#diff-da2d1e9c0593b79df5dbb23ce293a7b4R97).

Setting crashlytics_disable_auto_disabler solves the problem but it prevents from automatically enabling/disabling the data collection based on the environment which was the behavior in the previous version (enabled in prod, disabled in debug).

I believe the issue is caused by this (https://github.com/Aure77/react-native-firebase/blob/65c9edd32ab9c7c65f7ea9b6918838f6405e21ea/packages/app/ios_config.sh#L99) block of code where we set FirebaseCrashlyticsCollectionEnabled to 'NO`


Project Files

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby platform :ios, '10.0' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' def add_flipper_pods!(versions = {}) versions['Flipper'] ||= '~> 0.33.1' versions['DoubleConversion'] ||= '1.1.7' versions['Flipper-Folly'] ||= '~> 2.1' versions['Flipper-Glog'] ||= '0.3.6' versions['Flipper-PeerTalk'] ||= '~> 0.0.4' versions['Flipper-RSocket'] ||= '~> 1.0' pod 'FlipperKit', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configuration => 'Debug' # List all transitive dependencies for FlipperKit pods # to avoid them being linked in Release builds pod 'Flipper', versions['Flipper'], :configuration => 'Debug' pod 'Flipper-DoubleConversion', versions['DoubleConversion'], :configuration => 'Debug' pod 'Flipper-Folly', versions['Flipper-Folly'], :configuration => 'Debug' pod 'Flipper-Glog', versions['Flipper-Glog'], :configuration => 'Debug' pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configuration => 'Debug' pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configuration => 'Debug' pod 'FlipperKit/Core', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/CppBridge', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FBDefines', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configuration => 'Debug' end # Post Install processing for Flipper def flipper_post_install(installer) installer.pods_project.targets.each do |target| if target.name == 'YogaKit' target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '4.1' end end end end target 'grazie' do # Pods for grazie pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" pod 'React', :path => '../node_modules/react-native/' pod 'React-Core', :path => '../node_modules/react-native/' pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon" pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' target 'grazieTests' do inherit! :complete # Pods for testing end use_native_modules! # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable these next few lines. add_flipper_pods! post_install do |installer| flipper_post_install(installer) end end target 'grazie-tvOS' do # Pods for grazie-tvOS target 'grazie-tvOSTests' do inherit! :search_paths # Pods for testing end end ``` #### `AppDelegate.m`: ```objc // N/A ```


Android

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`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` OUTPUT GOES HERE ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [x] **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:** - `8.0.0` - **`Firebase` module(s) you're using that has the issue:** - `Crashlytics` - **Are you using `TypeScript`?** - `N` - **Are you using `Expo`?** - `N`


andersonaddo commented 4 years ago

To anyone who decides to investigate and fix this: this also might be a good opportunity to fix #3645

mikehardy commented 4 years ago

Fixing this is obviously important but I think it's vital to define what the desired end state is

It's a little bit intricate to get right but shouldn't be too hard to clean up if someone could post a PR?

SunilChiluvuri commented 4 years ago

From experience using the version prior to the version bump "@react-native-firebase/crashlytics": "^7.1.7",, and according to the docs here https://rnfirebase.io/crashlytics/usage The default state is 1) auto collection is enabled by default unless turned off by entry in firebase.json // /firebase.json { "react-native": { "crashlytics_auto_collection_enabled": false } } 2) Debug crash logs are disabled by default (release enabled by default) unless enabled by entry in firebase.json // /firebase.json { "react-native": { "crashlytics_debug_enabled": true } } 3) Crashlytics NDK reporting which is enabled by default unless disabled by entry in firbase.json // /firebase.json { "react-native": { "crashlytics_ndk_enabled": false } } Thanks for the update to migrate to Firebase Crashlytics. It would be awesome if the crash reporting could be restored to match what was documented.

mikehardy commented 4 years ago

@SunilChiluvuri great research, thank you posting the exact previous state for use here

I want to consolidate everything about RNFB-Crashlytics v8 init to one thread, here, so I am copying excellent comments from @pehagg here:

https://github.com/invertase/react-native-firebase/issues/3762#issuecomment-653382105

For the opt-in scenario, here's a comment that could potentially explains the behavior: firebase/firebase-ios-sdk#5805 (comment). Initially, I got the impression that data collection and crashlogs are enabled and disabled separately, but looking at the docs for checkForUnsentReports there seems to be a dependency between these two. I'll investigate this more in-depth and get back to this later this week.

https://github.com/invertase/react-native-firebase/issues/3762#issuecomment-653886844

Things are pretty complicated when it comes to how the Crashlytics configuration is handled. After browsing through the code both for the Firebase iOS SDK and RNFirebase, it looks like there's three configuration "systems" at play here. First, the Firebase iOS SDK seems to support both "old" (Fabric) and "new" configuration settings, and apparently the semantics differ for these two as per comments in the code. Then, as the third player, there's the configuration (RNFBPreferences) in RNFirebase, which AFAICT is something that is implemented in RNFirebase only.

So why does the opt-in case not work on iOS? The first thing to note is that according to Firebase docs, you are supposed to use checkForUnsetReports to ask for consent and use either sendUnsentReports or deleteUnsentReports based on what the user responds. I can't find any other mentioning of opt-in anywhere else in the docs. Either for Android or iOS. There is no evidence in the docs, as far as I can tell, that would state that automatic uploads should even work when automatic crash log collection is disabled. I enabled debugging (FIRDebugEnabled) for iOS and there were two log lines that were of interest. The first one stating that "Automatic data collection is disabled." and the other "Waiting for send/deleteUnsentReports to be called". This even after I had enabled crash logs collection via RNFirebase's setCrashlyticsCollectionEnabled.

Which leads us to the potential root cause. I can't for the life of me see a call in RNFirebase's setCrashlyticsCollectionEnabled that would call Firebase Crashlytics' native iOS SDK to change the setting. Maybe a call to the native API would enable automatic uploads, who knows? I have quite limited time right now to investigate this any further, but hopefully this helps someone who can take a closer look.

So we know the previous state, and we have some links into the SDK methods - we are close to knowing what to do, and I think the existing config infrastructure exists but just is not hooked up correctly, it might be possible for someone to give it a try in a PR?

andersonaddo commented 4 years ago

Can we pin this issue for a little bit? I think it's pretty relevant, and I don't want to to get buried in newer issues.

mikehardy commented 4 years ago

A good idea @andersonaddo I tried to alter the title to what I think is descriptive for people, but I'm always open to suggestion

davidvalari commented 4 years ago

Hi guys, react-native-friebase noob here. Do you know how to enable crashlytics_disable_auto_disabler?

Thanks alot

elledienne commented 4 years ago

Hi guys, react-native-friebase noob here. Do you know how to enable crashlytics_disable_auto_disabler?

Thanks alot

@davidvalari it's very easy, just create a firebase.json file in the root of your project and add the following content:

{
  "react-native": {
    "crashlytics_disable_auto_disabler": true
  }
}
airowe commented 4 years ago

Hi guys, react-native-friebase noob here. Do you know how to enable crashlytics_disable_auto_disabler? Thanks alot

@davidvalari it's very easy, just create a firebase.json file in the root of your project and add the following content:

{
  "react-native": {
    "crashlytics_disable_auto_disabler": true
  }
}

This did not work for me for iOS, unfortunately.

davidvalari commented 4 years ago

Thanks @elledienne, seems like what I've did was correct. It didn't work for me as well when I did this earlier though.

Aurelienlajoinie commented 4 years ago

Hello here, i've got the same issue on my project (on ios only). firebase.json seems ok and used correctly as i have "Using firebase.json from '/Users/***/firebase.json'" in pod install log

{
  "react-native": {
    "crashlytics_disable_auto_disabler": true,
    "crashlytics_debug_enabled": true,
    "crashlytics_auto_collection_enabled": true,
    "perf_auto_collection_enabled": true,
    "analytics_auto_collection_enabled": true
  }
}

Native logs seems ok too:

[Firebase/Crashlytics] Version 4.3.1
[Firebase/Crashlytics][I-CLS000000] [Crashlytics] Running on iPhone10,4, 12.2.0 (16E227)
[Firebase/Crashlytics][I-CLS000000] [Crashlytics:Settings] Settings expired because build instance changed
[Firebase/Crashlytics][I-CLS000000] Automatic data collection is enabled.
[Firebase/Crashlytics][I-CLS000000] Unsent reports will be uploaded at startup
[Firebase/Crashlytics][I-CLS000000] Settings downloaded successfully
[Firebase/Crashlytics][I-CLS000000] Starting onboarding with app update
[Firebase/Crashlytics][I-CLS000000] Completed application update

But i see nothing on the dashboard

package.json:

...
    "@react-native-firebase/analytics": "7.4.1",
    "@react-native-firebase/app": "8.3.0",
    "@react-native-firebase/crashlytics": "8.3.0",
    "@react-native-firebase/messaging": "7.6.1",
    "@react-native-firebase/perf": "7.3.1",
...

Edit: after a deploy on alpha production it works, so the the problem seems to be only in debug mode.

kcolton commented 4 years ago

@airowe @davidvalari I had to do a pod install after changing firebase.json to include "crashlytics_disable_auto_disabler": true.

I'm not very familiar with this library yet, so it's possible it was just coincidence/caching and it was really the rebuild of the project that got that change to take, but figured it was worth mentioning.

Like others, I was having trouble getting Crashlytics to recognize the SDK was installed properly during onboarding because of this. Once the configuration change took, I was able to see crash reports actually submitting in the logs.

Onboarding onto Crashlytics seems like where this has the biggest impact since it kind of stops you in tracks and makes you question if you've done something wrong with setup.

Since crashlytics_disable_auto_disabler is pretty cryptic and not really intended to be required for normal use, maybe an adjustment to the docs to mention auto-collection is disabled during development and to add crashlytics().sendUnsentReports() to your app startup to get through onboarding or to test crash reports with development builds would at least keep more people from falling in same trap.

Happy to create that PR if that sounds like a decent enough workaround while the greater mysteries of what should the defaults for these settings be are considered further.

mikehardy commented 4 years ago

I think it was the rebuild that did it, if I understand correctly (I'm iffy here) the build generates plist entries based on firebase.json - but I haven't inspected the code to verify so big grain of salt

Mostly replying to say that any PRs for documentation are most welcome! Especially from new users with fresh eyes, you know best what is hard to understand...

kcolton commented 4 years ago

Ah yeah, looks like the [CP-User][RNFB] Core Configuration] build phase from app/ios_config.sh copies the json into the plist and plist gets read at runtime so a normal build and run should take care of setting it w/o need of a pod install.

Just did a couple more tests and this time around the config seems to take without issue as long as the build phase is actually successful.

The pod install had nothing to do with it except it actually pointed out an error in my firebase.json (trailing comma from copy paste in my case) since pod install actually fails when that json is invalid.

The build phase on the other hand looks like it works successfully even if it couldn't actually parse the json file. There is a small note in the logs about the json parse error, but doesn't actually error out the script and I guess it winds up just using defaults which is as if crashlytics_disable_auto_disabler is false or not defined.

And yeah, I'll take a pass at some doc changes while this experience is fresh in memory. The other parts of it that tripped me up was that I was able to get through Android onboarding w/o the additional config and that crashlytics().isCrashlyticsCollectionEnabled was true throughout the whole process (even when crashlytics_disable_auto_disabler is false/undefined). Still don't have my head fully around the different config values and how they interact, but will do my best :)

mikehardy commented 4 years ago

The build phase on the other hand looks like it works successfully even if it couldn't actually parse the json file. There is a small note in the logs about the json parse error, but doesn't actually error out the script and I guess it winds up just using defaults which is as if crashlytics_disable_auto_disabler is false or not defined.

That in particular sounds like a bug - the exit code probably shouldn't be ignored :thinking:

pehagg commented 4 years ago

Hi guys, react-native-friebase noob here. Do you know how to enable crashlytics_disable_auto_disabler? Thanks alot

@davidvalari it's very easy, just create a firebase.json file in the root of your project and add the following content:

{
  "react-native": {
    "crashlytics_disable_auto_disabler": true
  }
}

That would be crashlytics_auto_collection_enabled, not crashlytics_disable_auto_disabler. Or do we have an issue with the docs as. well?

pehagg commented 4 years ago

Nevermind, this seems to exist. I misread the key.

andersonaddo commented 4 years ago

https://invertase.canny.io/react-native-firebase/p/verbose-logging-mode-for-crashlytics

Just so it doesn't get lost

VincenDev commented 4 years ago

I have doubts, i have this problem too on iOS, on Android it just works fine.

This problem is only on debug/developing phase?

Im trying to active crashlytics, but i can't, the crashlytics().crash(); closes the app, but is not sendeed to the crashlytics panel. Y also tried crashlytics().sendUnsentReports(); at index.js and nothing changes.

I tested it on a simulator, in a real device debug/release build (run from xCode and stoped and run without xcode) and nothing works.

"@react-native-firebase/app": "^8.3.1",
"@react-native-firebase/crashlytics": "^8.3.1",

Its my first time using this library, i should try a old version?

mikehardy commented 4 years ago

@VincenDev going to older versions will likely not help you. Last resort there. Have you created an empty firebase.json ? There are quite a few things documented here as things to try / workarounds to engage. That one affects which entries are injected into the plist file and may cause crashes not to log.

Please note some (including myself) are reporting with no problem, on the most up to date versions, so it can work, just that for some set of edge cases there are definitely problems - that's what we're working through here.

VincenDev commented 4 years ago

@VincenDev going to older versions will likely not help you. Last resort there. Have you created an empty firebase.json ? There are quite a few things documented here as things to try / workarounds to engage. That one affects which entries are injected into the plist file and may cause crashes not to log.

Please note some (including myself) are reporting with no problem, on the most up to date versions, so it can work, just that for some set of edge cases there are definitely problems - that's what we're working through here.

I've been trying things for like 4 hours

Info.plist

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

firebase.json

{
  "react-native": {
    "crashlytics_debug_enabled": true
  }
}

or

{
  "react-native": {
    "crashlytics_disable_auto_disabler": true,
    "crashlytics_debug_enabled": true
  }
}

Adding Arguments to xCode scheme

 -FIRDebugEnabled
 -FIRAnalyticsDebugenabled

react-native run-ios on simulator Debug RUN, Release RUN on Simulator (Pressing STOP after run, then open the app from simulator). Debug RUN, Release RUN on iPhone.

Did I leave something? Right now i don't know what to do next, i don't know how to test the things, if a release/debug on simulator or real device, i should remove everything and try something new?

mikehardy commented 4 years ago

There was mention above that a pod install after altering firebase.json helped someone, in general you might try a npx react-native-clean-project to make sure none of the iOS build toolchain caching layers are getting you - there are quite a few and frequently go cache-incoherent on me. It seems like you're trying all the things I'd recommend. As a last a resort (should take less than 3 hours...) you can try doing a one-off throwaway built off https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

also make sure you have uploaded dSYMS for iOS crashes or they are not visible in the console either (for that reason I typically do TestFlight builds to test iOS crash behavior, as part of my fastlane build I carry the dSYMS from Apple to Firebase automatically https://stackoverflow.com/questions/54577202/how-to-run-upload-symbols-to-upload-dsyms-as-a-part-of-xcode-build-process/55796619#55796619)

mikehardy commented 4 years ago

One bugfix from @mars-lan for some cases failing to register iOS crashes was just released a couple hours ago as @react-native-firebase/crashlytics@8.3.2 and you will want to upgrade if you are suffering with this. Fascinating discussion on the related issue upstream https://github.com/firebase/firebase-ios-sdk/issues/6028 resulting in a change here. I hope it provides relief for some, please report your experience and remember to the best of our knowledge you will want to:


{
  "react-native": {
    "crashlytics_disable_auto_disabler": true,
    "crashlytics_debug_enabled": true
  }
}
VincenDev commented 4 years ago

There was mention above that a pod install after altering firebase.json helped someone, in general you might try a npx react-native-clean-project to make sure none of the iOS build toolchain caching layers are getting you - there are quite a few and frequently go cache-incoherent on me. It seems like you're trying all the things I'd recommend. As a last a resort (should take less than 3 hours...) you can try doing a one-off throwaway built off https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

also make sure you have uploaded dSYMS for iOS crashes or they are not visible in the console either (for that reason I typically do TestFlight builds to test iOS crash behavior, as part of my fastlane build I carry the dSYMS from Apple to Firebase automatically https://stackoverflow.com/questions/54577202/how-to-run-upload-symbols-to-upload-dsyms-as-a-part-of-xcode-build-process/55796619#55796619)

Well, yesterday after try npx react-native-clean-project, pod install and upload the dSYMS file, no report was sent/received in Firebase panel, so i decided go to sleep and continue today

Today, the first thing i do was open the panel and i found 30 crash reports, so i have no idea why they showed 8 hours after causing the last crash report ( Yesterday I was refreshing the page all time )..

So i don't know what was the solution, Today i changed the Version/Build numbers and after run on iPhone 7 (Debug) without uploading the new dSYMS, the crash reports are visible immediately at Firebase Panel.

So im gonna post my current settings in case I could help someone.

Index.js or App.js ComponentDidMount()

crashlytics().sendUnsentReports();

Firebase.json

{
  "react-native": {
    "crashlytics_disable_auto_disabler": true,
    "crashlytics_debug_enabled": true,
    "crashlytics_auto_collection_enabled": true,
    "perf_auto_collection_enabled": true,
    "analytics_auto_collection_enabled": true
  }
}

info.plist

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

xCode -> Product -> Scheme -> Edit Scheme -> Arguments -> Arguments Passed On Launch

-FIRDebugEnabled
-FIRAnalyticsDebugEnabled

If i have time, i'm gonna try to remove some of these settings and see if still working.

Thanks

mikehardy commented 4 years ago

I appreciate the success report! I think you'll continue to find success with most of those gone (perhaps all of them on release builds). A shame that it was an 8 hour lag in the end! Super frustrating. There is a feature request to enable more transparency in the logs on whether crashlytics succeeded and uploaded reports etc etc that might help in this case but it will need someone in the community to implement it I think.

jimmyceroneii commented 4 years ago

@VincenDev I had the same issue with a lag in crash report time. Mine didn't kick in until a couple hours later, but still long enough that it was hard to figure out what changes triggered the success. From what I can tell, it was the addition of "Crashlytics_disable_auto_disabler", but I'm not 100% sure.

{ "react-native": { "crashlytics_disable_auto_disabler": true, "crashlytics_debug_enabled": true } }

It does seem like Firebase should change it's docs (at least during COVID) to update the reporting time for a crash from 5 minutes...

gabrieldefazio commented 4 years ago

@jimmyceroneii this finally did it for me, too!

mikehardy commented 4 years ago

I'm daring to hope we may have predictable, successful behavior here. If anyone can still reproduce failures on this while using firebase.json with

{ "react-native": { "crashlytics_disable_auto_disabler": true, "crashlytics_debug_enabled": true } }

...with @react-native-firebase/crashlytics@8.3.2 (or higher) on clean builds (use npx react-native-clean-project if you have to), with dSYMs uploaded and accounting for lag in report time, please report failures now

I'm going to close this because I think it's working but of course we can reopen if we need to, we want it to work obviously

Huge collaboration here, thanks everyone

andersonaddo commented 4 years ago

So it's been observed that this module's default behavior differs from upstream sdk's default behavior. That might be looked into :)

jimmyceroneii commented 4 years ago

@andersonaddo how does it differ? Just curious.

andersonaddo commented 4 years ago

So from my understanding of how the iOS debugging experience is (https://firebase.google.com/docs/crashlytics/test-implementation?platform=ios), crashlytics_disable_auto_disabler should default to true. Crashlytics should work in non-debug build out of the box. I'm not sure what the default value should be for crashlytics_debug_enabled, because I'm surmising a debug RN build will have two debuggers attached to it (the metro debugger and the Xcode debugger).

EDIT: Aaaactually wait...was this problem a a problem that only affected dev builds?

csouth3 commented 4 years ago

This problem affected release builds for us.

I'd also add that the documentation for react-native-firebase does not mention the crashlytics_disable_auto_disabler setting for firebase.json anywhere, which made for a painful experience to try to determine why nothing was appearing in the Firebase console even after waiting for 24 hours. Dev and release builds are both working with the above config set.

mikehardy commented 4 years ago

Yes @csouth3 ! we'll look at what the defaults should be (to align with upstream where possible, and be consistent cross-platform most of all) and document it now that it seems to actually work. Getting it working consistently was step 1, now documentation to save future devs the pain is next

lukemcgregor commented 4 years ago

I just spent ages trying to work out why my crashlytics stopped sending in iOS, it turned out it was to do with this issue, but working out what was going on took ages.

It would have helped a lot if I could have turned on a logging mode so that I could see more info about crashes that were recorded and if they were sent or not. It would also be really useful to see something like not sent because logging is turned off by default

Feature request for verbose logging below https://invertase.canny.io/react-native-firebase/p/verbose-logging-mode-for-crashlytics

mikehardy commented 4 years ago

I have enough time to look at the defaults and harmonize them + docs, but I likely won't have enough time (or at least won't for quite a while) to do a verbose logging mode, but I agree that sounds like an excellent idea. If anyone proposed a PR for that, it would be fantastic - there's nothing in progress or concretely planned at the moment so there would not be duplication of effort if someone gave it a shot

machouz commented 4 years ago

After a deep investigation we found that for iOS the [CP-User] [RNFB] Core Configuration script automatically set the FirebaseCrashlyticsCollectionEnabled entry in the Info.plist to NO value if crashlytics_disable_auto_disabler is not set to true in the firebase.json. This part of the script is responsible :

  # config.crashlytics_disable_auto_disabler - undocumented for now - mainly for debugging, document if becomes usful
  _CRASHLYTICS_AUTO_DISABLE_ENABLED=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "crashlytics_disable_auto_disabler")
  if [[ $_CRASHLYTICS_AUTO_DISABLE_ENABLED == "true" ]]; then
    echo "Disabled Crashlytics auto disabler." # do nothing
  else
    _PLIST_ENTRY_KEYS+=("FirebaseCrashlyticsCollectionEnabled")
    _PLIST_ENTRY_TYPES+=("bool")
    _PLIST_ENTRY_VALUES+=("NO")
  fi

Since the script is also executed in release mode the problem also affect release builds like said by @csouth3. So the solution like said by @jimmyceroneii is to put in the firebase.json: { "react-native": { "crashlytics_disable_auto_disabler": true}} or to directly manually force a true value to the FirebaseCrashlyticsCollectionEnabled entry by adding in the Info.plist :

<key>FirebaseCrashlyticsCollectionEnabled</key>
  <true/>
justincbeck commented 4 years ago

One bugfix from @mars-lan for some cases failing to register iOS crashes was just released a couple hours ago as @react-native-firebase/crashlytics@8.3.2 and you will want to upgrade if you are suffering with this. Fascinating discussion on the related issue upstream firebase/firebase-ios-sdk#6028 resulting in a change here. I hope it provides relief for some, please report your experience and remember to the best of our knowledge you will want to:

  • use 8.3.2 version or higher
  • verify you have a firebase.json in your project - empty if it needs to be (separate issue logged)
  • your firebase.json is well-formed JSON, parsing errors will cause silent failure (separate issue logged)
  • have the correct keys set for disabling the auto disabler, etc like this perhaps:
{
  "react-native": {
    "crashlytics_disable_auto_disabler": true,
    "crashlytics_debug_enabled": true
  }
}
  • run npx react-native-clean-project to make sure you are squeaky clean for your build
  • build it and make sure the dSYMS are uploaded
  • crash it and then restart the app
  • wait a little bit and see ? 🤞

FWIW, I'm on 8.3.4 and I'm still seeing this issue.

jimmyceroneii commented 4 years ago

After a deep investigation we found that for iOS the [CP-User] [RNFB] Core Configuration script automatically set the FirebaseCrashlyticsCollectionEnabled entry in the Info.plist to NO value if crashlytics_disable_auto_disabler is not set to true in the firebase.json. This part of the script is responsible :

  # config.crashlytics_disable_auto_disabler - undocumented for now - mainly for debugging, document if becomes usful
  _CRASHLYTICS_AUTO_DISABLE_ENABLED=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "crashlytics_disable_auto_disabler")
  if [[ $_CRASHLYTICS_AUTO_DISABLE_ENABLED == "true" ]]; then
    echo "Disabled Crashlytics auto disabler." # do nothing
  else
    _PLIST_ENTRY_KEYS+=("FirebaseCrashlyticsCollectionEnabled")
    _PLIST_ENTRY_TYPES+=("bool")
    _PLIST_ENTRY_VALUES+=("NO")
  fi

Since the script is also executed in release mode the problem also affect release builds like said by @csouth3. So the solution like said by @jimmyceroneii is to put in the firebase.json: { "react-native": { "crashlytics_disable_auto_disabler": true}} or to directly manually force a true value to the FirebaseCrashlyticsCollectionEnabled entry by adding in the Info.plist :

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

Wow @machouz - great work! Thank you so much for doing this deep dive and helping all of us understand why this error is persisting!!!

MaxToyberman commented 4 years ago

One bugfix from @mars-lan for some cases failing to register iOS crashes was just released a couple hours ago as @react-native-firebase/crashlytics@8.3.2 and you will want to upgrade if you are suffering with this. Fascinating discussion on the related issue upstream firebase/firebase-ios-sdk#6028 resulting in a change here. I hope it provides relief for some, please report your experience and remember to the best of our knowledge you will want to:

  • use 8.3.2 version or higher
  • verify you have a firebase.json in your project - empty if it needs to be (separate issue logged)
  • your firebase.json is well-formed JSON, parsing errors will cause silent failure (separate issue logged)
  • have the correct keys set for disabling the auto disabler, etc like this perhaps:
{
  "react-native": {
    "crashlytics_disable_auto_disabler": true,
    "crashlytics_debug_enabled": true
  }
}
  • run npx react-native-clean-project to make sure you are squeaky clean for your build
  • build it and make sure the dSYMS are uploaded
  • crash it and then restart the app
  • wait a little bit and see ? 🤞

I'm on 8.4.2 and still have issues

mikehardy commented 4 years ago

@MaxToyberman "issues" -> be very, very specific. Open a new issue and provide all the relevant information please

rossjohnsonMP commented 4 years ago

build it and make sure the dSYMS are uploaded

Sorry to drag up this issue but, we've been using RNFB (huge thanks btw) for a fairly long while and to my knowledge have never done anything specific to upload dSYSMs, is this a recent thing that this is now required? Theres no mention of this being a requirement in the crashlytics docs or how best to do it (i see above you've suggested to add as a step in a fastlane build)

mikehardy commented 4 years ago

@rossjohnsonMP you might like https://stackoverflow.com/questions/54577202/how-to-run-upload-symbols-to-upload-dsyms-as-a-part-of-xcode-build-process/55796619#55796619

rossjohnsonMP commented 4 years ago

@rossjohnsonMP you might like https://stackoverflow.com/questions/54577202/how-to-run-upload-symbols-to-upload-dsyms-as-a-part-of-xcode-build-process/55796619#55796619

@mikehardy

Super detailed I'm sure will help if it comes to it, as it stands im not seeing errors come through to the console, I've followed all the steps above (aside from the dsyms upload) in the console I see a bit warning saying that its not showing a few crashes due to missing dsyms but its from super old versions of our app - so seemingly not whats causing the issue?

don't see anything in pod install logs, app install logs or the device logs

mars-lan commented 4 years ago

build it and make sure the dSYMS are uploaded

Sorry to drag up this issue but, we've been using RNFB (huge thanks btw) for a fairly long while and to my knowledge have never done anything specific to upload dSYSMs, is this a recent thing that this is now required? Theres no mention of this being a requirement in the crashlytics docs or how best to do it (i see above you've suggested to add as a step in a fastlane build)

This is where the magic happens: https://github.com/invertase/react-native-firebase/blob/cad58e178b43dea461e17fa4a0a3fecd507ba68a/packages/crashlytics/ios_config.sh & https://github.com/invertase/react-native-firebase/blob/cad58e178b43dea461e17fa4a0a3fecd507ba68a/packages/crashlytics/react-native.config.js

rossjohnsonMP commented 4 years ago

This is where the magic happens: https://github.com/invertase/react-native-firebase/blob/cad58e178b43dea461e17fa4a0a3fecd507ba68a/packages/crashlytics/ios_config.sh & https://github.com/invertase/react-native-firebase/blob/cad58e178b43dea461e17fa4a0a3fecd507ba68a/packages/crashlytics/react-native.config.js

Yeah looks like its doing the business:

info: Exec FirebaseCrashlytics Run from Pods
Running upload-symbols in Build Phase mode
Validating build environment for Crashlytics...
Validation succeeded. Exiting because upload-symbols was run in validation mode

and then device run logs

[Firebase/Crashlytics][I-CLS000000] [Crashlytics] Running on iOS Simulator (iPhone), 13.7.0 (19F101)
[Firebase/Crashlytics][I-CLS000000] Root: {blah}
[Firebase/Crashlytics][I-CLS000000] [Crashlytics:Crash:Reports:Event] Registered Firebase Analytics event listener
[Firebase/Crashlytics][I-CLS000000] Automatic data collection is enabled.
[Firebase/Crashlytics][I-CLS000000] Unsent reports will be uploaded at startup
Minishlink commented 4 years ago

@rossjohnsonMP When you have bitcode enabled, Apple recompiles your app on their servers when you push a new app version. So the dsyms you had locally doesn't match the app that is used by users. That's why in this case you need to download the dsyms from Apple's servers and upload them to Crashlytics. Fastlane has some actions that makes the process very easy.

rossjohnsonMP commented 4 years ago

@Minishlink appreciate the explanation but theres absolutely no mention of needing to do this in the docs and we've been using RNFB for over 18 months without having to do this - I thought as mentioned by @mars-lan the build script that runs "${PODS_ROOT}/FirebaseCrashlytics/run" is meant to handle this?

also adding to all of this, I don't see any crash reports sent locally or through a version on testflight

mikehardy commented 4 years ago

@rossjohnsonMP you may have unreasonable expectations. If you have just upgraded across major versions of crashlytics you'll note that we switched from the old Fabric-based Crashlytics - in response to upstream switch - to Firebase Crashlytics. You'll understand that this is a volunteer project and we did our best during this switch but it is not perfect as documented above.

When I read your comment, I read a lot of explanation of expectations but I do not read anything confirming that you have performed the steps specified in order to make sure the new Firebase Crashlytics-based implementation will work.

Immediately prior to issue close here this was stated: https://github.com/invertase/react-native-firebase/issues/3879#issuecomment-678389795

Please report back how it goes when you perform those steps.

There is pending work to make fewer (or none) of those steps necessary. If you'd like to propose a PR that corrects the assumption in the run script you linked that the firebase.json will exist, that would be great! If you'd like to propose a PR that makes it so that firebase logs events in debug mode by default that would be great!

mykelaballe commented 3 years ago

im still experiencing this issue, im using:

@react-native-firebase/app@8.3.0 @react-native-firebase/crashlytics@8.3.0

$FirebaseSDKVersion = '6.32.2' as well in my podfile

i have also added firebase.json with these configs: { "react-native": { "crashlytics_debug_enabled": true, "crashlytics_disable_auto_disabler": true } }

to force crash the app, i tried adding an unimported component, the app crashed successfully but still not reflecting in the dashboard

*note that the app was not released thru testflight and production, i just generated an .ipa file and installed on a real device

kale1d commented 3 years ago
  • build it and make sure the dSYMS are uploaded

Hi, i'm trying to configure Crashlytics with iOS and read in some places about upload dSYMS, i'm not sure how to do this and i can't find any info about that. Can anyone help me with this? Thanks!