Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 of 10 tasks
elledienne opened this issue Jul 5, 2020 · 57 comments
Closed
2 of 10 tasks

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

elledienne opened this issue Jul 5, 2020 · 57 comments
Labels

Comments

@elledienne
Copy link

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
  • I'm using Pods and my Podfile looks like:
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:

// 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:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

 OUTPUT GOES HERE
  • Platform that you're experiencing the issue on:
    • 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:
    • 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
Copy link
Contributor

andersonaddo commented Jul 5, 2020

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

@andersonaddo andersonaddo added the Service: Crashlytics Firebase Crashlytics label Jul 5, 2020
@mikehardy
Copy link
Collaborator

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

  • there should be an API which correctly toggles the collection state, right?
  • as a separate question I think the API already exists but may just not be working correctly? did v5 have an API for it?
  • we need to decide the default states. I think the default should be no collection in debug, yes collection in release
  • the initialization state should be configurable in firebase.json or plist or ?

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
Copy link

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
Copy link
Collaborator

@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:

#3762 (comment)

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.

#3762 (comment)

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
Copy link
Contributor

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 mikehardy pinned this issue Jul 22, 2020
@mikehardy mikehardy changed the title 🔥 Crashlytics 8.0.1 not collecting data 🔥 Crashlytics 8.0.1 not collecting data by default on iOS Jul 22, 2020
@mikehardy
Copy link
Collaborator

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
Copy link

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

Thanks alot

@elledienne
Copy link
Author

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
Copy link

airowe commented Jul 31, 2020

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
Copy link

davidvalari commented Jul 31, 2020

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
Copy link

Aurelienlajoinie commented Aug 6, 2020

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
Copy link

kcolton commented Aug 13, 2020

@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
Copy link
Collaborator

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
Copy link

kcolton commented Aug 13, 2020

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
Copy link
Collaborator

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 🤔

@pehagg
Copy link
Contributor

pehagg commented Aug 18, 2020

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
Copy link
Contributor

pehagg commented Aug 18, 2020

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

@Ehesp Ehesp unpinned this issue Aug 19, 2020
@andersonaddo andersonaddo pinned this issue Aug 19, 2020
@andersonaddo
Copy link
Contributor

@VincenDev
Copy link

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
Copy link
Collaborator

@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.

@mikehardy
Copy link
Collaborator

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
Copy link

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
Copy link
Collaborator

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
Copy link

machouz commented Aug 26, 2020

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
Copy link

justincbeck commented Aug 26, 2020

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
Copy link

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
Copy link

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
Copy link
Collaborator

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

@rossjohnsonMP
Copy link

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)

@rossjohnsonMP
Copy link

@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
Copy link
Contributor

mars-lan commented Sep 7, 2020

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
Copy link

rossjohnsonMP commented Sep 7, 2020

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
Copy link
Contributor

@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
Copy link

@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
Copy link
Collaborator

@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: #3879 (comment)

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
Copy link

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
Copy link

kale1d commented Oct 13, 2020

  • 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!

@mikehardy
Copy link
Collaborator

@kale1d please read the above comments carefully, especially https://stackoverflow.com/questions/54577202/how-to-run-upload-symbols-to-upload-dsyms-as-a-part-of-xcode-build-process/55796619#55796619

@ajaykumar97
Copy link

I was also facing the same issue. I was not receiving the Crash reports on the Firebase Console. After spending 2 days for finding the root cause of the problem, this worked at the end 👍 :

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

@smaorus
Copy link

smaorus commented Oct 28, 2020

I recently upgraded our react native firebase libraries and unlike the other libraries I can't get crashlytics to register crashes in the firebase console. Issue only in ios, android works fine.

What i've tried so far:

  1. Upgraded to rn crashlytics latest version: 8.4.11. Also upgraded the other firebase modules to their latest version.
  2. Use latest native Firebase 6.34.0
  3. Added a well formed firebase.json to the react native root dir (also tried in the ios dir). Tried both with only crashlytics_disable_auto_disabler and crashlytics_debug_enabled set to true and
  4. Made sure a correct GoogleService-Info.plist file is present (analytics works fine)
  5. I have a missing dSYM message in the console however the missing required dsym belongs to an older version. Also we are not using bitcode and I was not able to download dsyms from the appstore, both manually and using fastlane. I also manually uploaded any dsym on my machine using the upload-symbols script. I will also point out that before upgrading crashes were registered in the console while having this message.
  6. I crashed the app on a simulator and on a real device, both when connected and not connected to Xcode and turned the app on after the crash to allow the logs to upload.
  7. I used both the crash() rn method and a fatalError() call in our native module
  8. I tried reverting to an older version like this thread suggests but this also hasn't worked.
  9. When I run the app after a crash and call didCrashDuringPreviousExecution I get false, perhaps that has something to do with it?
  10. I'm using RN < 0.60 and followed the extra installation steps stated on the website.

Unsure how to proceed from here. What do you guys suggest? Is there anymore logging I could enable?

@mikehardy
Copy link
Collaborator

When I run the app after a crash and call didCrashDuringPreviousExecution I get false, perhaps that has something to do with it?

That's a strong indicator something is wrong. What? I'm not sure, it appears you are doing everything correctly. I can only recommend reaching in to node_modules and adding some output around the crash test function, or trying some of the other functions. Before doing that you might try it in release mode, and/or try a javascript-level crash (in release mode so you don't get caught in redbox) to see what's happening

@smaorus
Copy link

smaorus commented Oct 29, 2020

I was able to locate the problem after taking a closer look at the native crashlytics logs. I was using the deprecated firebase_crashlytics_collection_enabled key in the project's plist file instead of FirebaseCrashlyticsCollectionEnabled.
I was missing the crucial log messages because I had OS_ACTIVITY_MODE=disable on in my environment variables.

@mikehardy mikehardy unpinned this issue Oct 31, 2020
@whalemare
Copy link

whalemare commented Nov 24, 2021

In my case, all reports was blocked by VPN
After disabling it, it successfully send

@jorgequintt
Copy link

If by any chance someone's still having problems with { "react-native": { "crashlytics_disable_auto_disabler": true}} being ignored in firebase.json on iOS, this is what was happening to me: The script in charge of finding and parsing this file was finding another file with the same name in another folder

Screenshot_30

In my case, it was using my "firebase.json" inside my firebase project folder (even though I had the correct one at the root of my project). I accidentally fixed it while pasting the firebase.json inside the ios/ folder. So if you're having trouble with this even after setting crashlytics_disable_auto_disabler": true, it might be because you have another file called firebase.json inside your project and is using that one instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests