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

Crashlytics in IOS is not sending information to Firebase console #3762

Closed
2 of 10 tasks
Luckygirlllll opened this issue Jun 9, 2020 · 31 comments
Closed
2 of 10 tasks

Comments

@Luckygirlllll
Copy link

Luckygirlllll commented Jun 9, 2020

Issue

Describe your issue here

Crashlytics is not sending information to Firebase console.
I can see Crash free statistic though.
Screenshot 2020-06-09 at 17 57 42

Project Files

Javascript

Click To Expand

package.json:

    "@react-native-firebase/app": "^6.7.1",
    "@react-native-firebase/crashlytics": "^6.7.1",
    "@react-native-firebase/perf": "^6.1.0",

firebase.json for react-native-firebase v6:

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

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-unimodules/cocoapods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'my_project' do
  rnPrefix = "../node_modules/react-native"

  # React Native and its dependencies
  pod 'FBLazyVector', :path => "#{rnPrefix}/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "#{rnPrefix}/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "#{rnPrefix}/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "#{rnPrefix}/Libraries/TypeSafety"
  pod 'React', :path => "#{rnPrefix}/"
  pod 'React-Core', :path => "#{rnPrefix}/"
  pod 'React-CoreModules', :path => "#{rnPrefix}/React/CoreModules"
  pod 'React-RCTActionSheet', :path => "#{rnPrefix}/Libraries/ActionSheetIOS"
  pod 'React-RCTAnimation', :path => "#{rnPrefix}/Libraries/NativeAnimation"
  pod 'React-RCTBlob', :path => "#{rnPrefix}/Libraries/Blob"
  pod 'React-RCTImage', :path => "#{rnPrefix}/Libraries/Image"
  pod 'React-RCTLinking', :path => "#{rnPrefix}/Libraries/LinkingIOS"
  pod 'React-RCTNetwork', :path => "#{rnPrefix}/Libraries/Network"
  pod 'React-RCTSettings', :path => "#{rnPrefix}/Libraries/Settings"
  pod 'React-RCTText', :path => "#{rnPrefix}/Libraries/Text"
  pod 'React-RCTVibration', :path => "#{rnPrefix}/Libraries/Vibration"
  pod 'React-Core/RCTWebSocket', :path => "#{rnPrefix}/"
  pod 'React-Core/DevSupport', :path => "#{rnPrefix}/"
  pod 'React-cxxreact', :path => "#{rnPrefix}/ReactCommon/cxxreact"
  pod 'React-jsi', :path => "#{rnPrefix}/ReactCommon/jsi"
  pod 'React-jsiexecutor', :path => "#{rnPrefix}/ReactCommon/jsiexecutor"
  pod 'React-jsinspector', :path => "#{rnPrefix}/ReactCommon/jsinspector"
  pod 'ReactCommon/jscallinvoker', :path => "#{rnPrefix}/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "#{rnPrefix}/ReactCommon"
  pod 'Yoga', :path => "#{rnPrefix}/ReactCommon/yoga"
  pod 'DoubleConversion', :podspec => "#{rnPrefix}/third-party-podspecs/DoubleConversion.podspec"
  pod 'glog', :podspec => "#{rnPrefix}/third-party-podspecs/glog.podspec"
  pod 'Folly', :podspec => "#{rnPrefix}/third-party-podspecs/Folly.podspec"
  
  permissions_path = '../node_modules/react-native-permissions/ios'

   pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
   pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
   pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
   pod 'Permission-Motion', :path => "#{permissions_path}/Motion.podspec"
   pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"

  # Other native modules

  # Automatically detect installed unimodules
  use_unimodules!

  # react-native-cli autolinking
  use_native_modules!
end

# N/A

AppDelegate.m:

#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#import <UMCore/UMModuleRegistry.h>
#import <UMReactNativeAdapter/UMNativeModulesProxy.h>
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
#import <Firebase.h>

@implementation AppDelegate

@synthesize window = _window;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  if ([FIRApp defaultApp] == nil) {
     [FIRApp configure];
   }
  
  self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"civicchamps" initialProperties:nil];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];

  [super application:application didFinishLaunchingWithOptions:launchOptions];

  return YES;
}

- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
{
  NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];
  // You can inject any extra modules that you would like here, more information at:
  // https://facebook.github.io/react-native/docs/native-modules-ios.html#dependency-injection
  return extraModules;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
#ifdef DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end

// 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
System:
    OS: macOS 10.15.3
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 18.68 MB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.15.0 - /usr/local/bin/node
    Yarn: 1.12.3 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 23, 24, 25, 26, 27, 28, 29
      Build Tools: 23.0.1, 25.0.0, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 27.0.1, 27.0.3, 28.0.3
      System Images: android-23 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-25 | Google Play Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
  npmPackages:
    react: ~16.9.0 => 16.9.0 
    react-native: ~0.61.4 => 0.61.5 
  npmGlobalPackages:
    create-react-native-app: 1.0.0
    react-native-cli: 2.0.1
    react-native-device-info: 2.0.0
    react-native-fabric: 0.5.2
    react-native-gesture-handler: 1.4.1
    react-native-git-upgrade: 0.2.7
    react-native-maps: 0.25.0
    react-native-permissions: 2.0.2
    react-native-reanimated: 1.2.0
  • 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:
    • 6.7.1
  • Firebase module(s) you're using that has the issue:
    • "@react-native-firebase/crashlytics": "^6.7.1",
  • Are you using TypeScript?
    • N


@mikehardy
Copy link
Collaborator

Perhaps the dSYMs are missing? https://stackoverflow.com/questions/54577202/how-to-run-upload-symbols-to-upload-dsyms-as-a-part-of-xcode-build-process/55796619#55796619

That's a classic, and that answer is the source of basically all my stackoverflow karma 😅 - if not, unknown but your versions here are out of date, I'd make certain you were fully up to date on @react-native-firebase packages and the current iOS SDK is 6.26.0 (you can override that to make sure you have that current version like so https://rnfirebase.io/#ios )

@Luckygirlllll
Copy link
Author

@mikehardy I have uploaded dSYMs I also updated react-native-firebase and react-native-firebase/crashlytics to the latest version, but still no luck.

@slavikdenis
Copy link

slavikdenis commented Jun 11, 2020

The same thing happening to us on Android as well somehow. Related to #3648 I guess

@Luckygirlllll
Copy link
Author

Extra info: I had Fabric before for crashes, I migrated to Firebase, but I have a concerns that it can be a reason for current problems with IOS crash reporting.

Screenshot 2020-06-16 at 10 59 14

@mikehardy
Copy link
Collaborator

@Luckygirlllll I recommend making a small throwaway app with crashlytics in it and proving the integration out with nothing much more than a specific "crash now" button in the app. You can start with this, just need to configure a matching app in the console and get the plist/json files from google https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-v6.sh

@calintamas
Copy link

@mikehardy Hi, thanks for all the work on this!

Are there plans to upgrade to latest SDK (which doesn't use Fabric anymore)?
https://firebase.google.com/docs/crashlytics/upgrade-sdk

@Luckygirlllll
Copy link
Author

@calintamas yeah, it should happen soon, I guess. #3771

@timomeara
Copy link

I was having this issue as well.
i migrated RNFB to the 6x packages and after that release i had no data in the firebase crashlytics console.
same issue after updating to the 7.x packages

the fix for me was to add back all the Fabric props in the info.plist and to replace the build phase script from the migration documentation wth the original fabric script.

info.plist:

  <dict>
    <key>APIKey</key>
    <string>[MY_API_KEY]</string>
    <key>Kits</key>
    <array>
      <dict>
        <key>KitInfo</key>
        <dict/>
        <key>KitName</key>
        <string>Crashlytics</string>
      </dict>
    </array>
  </dict>


script in build phases:
"${PODS_ROOT}/Fabric/run" [MY_API_KEY] [MY_SECRET]
script input files
$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

@Luckygirlllll
Copy link
Author

@timomeara Interesting, I will try that!

@mikehardy
Copy link
Collaborator

@timomeara how will you be affected by the migration path google is pursuing from fabric to crashlytics? I'm concerned you may have your crash reporting shut down when they turn off the fabric stuff completely

@timomeara
Copy link

@timomeara how will you be affected by the migration path google is pursuing from fabric to crashlytics? I'm concerned you may have your crash reporting shut down when they turn off the fabric stuff completely

that's a good question @mikehardy. I was actually going to reach out to you about an answer.
you mention a PR here:
#3771 (comment)
i suppose that i will await a release that includes a pure firebase solution and upgrade then.
is there any way to not use Fabric in the current release?

@mikehardy
Copy link
Collaborator

For original fabric folks that were fabric/fabric I am not sure. This library is currently what I refer to as "crashlytics/fabric" with the PR you linked taking it to the end state of "crashlytics/crashlytics". I understand people going from step 2 ("C/F") to step 3 ("C/C") it's basically nothing-burger. But for people starting at fabric/fabric I have no experience or special knowledge sorry

@timomeara
Copy link

timomeara commented Jun 30, 2020

For original fabric folks that were fabric/fabric I am not sure. This library is currently what I refer to as "crashlytics/fabric" with the PR you linked taking it to the end state of "crashlytics/crashlytics". I understand people going from step 2 ("C/F") to step 3 ("C/C") it's basically nothing-burger. But for people starting at fabric/fabric I have no experience or special knowledge sorry

gotcha- but i still don't understand why i need the Fabric api keys and such when others do not.
my first builds has no ref to Fabric that I included... i'm sure that my firebase app has (hidden) Fabric fingerprints all over it, but the android build had no issues... plenty of crash reports there ;)
why would ios be so different?
when do you think we'll see the C/C lib?

btw: @mikehardy, i understand that you volunteer your time here and i appreciate your taking the time to answer all our questions.
i'm not much of a native coder but if there some way i can help out, please don't hesitate to ask

@mikehardy
Copy link
Collaborator

I'm hoping the ingestion of the PR that goes to the end state of "Firebase Crashlytics" (which I do refer to as C/C yes) happens pretty quickly. It's very close to ready but appears to be having trouble getting the final polish it needs from the original poster. Hopefully soon. Wish I knew more about Fabric original state and how to move from it, sorry I don't

@mikehardy
Copy link
Collaborator

Firebase Crashlytics PR just merged! release in progress (CI takes a while). From the perspective of this issue, that means that it is probably more confused as to what we know for sure and what we are guessing on unfortunately, as whatever testing has been performed should be done on the updated crashlytics release.

@vanhungoz
Copy link

vanhungoz commented Jul 1, 2020

i am using

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

but, can not see any crash report on firebase console

@mikehardy
Copy link
Collaborator

@vanhungoz I'm sorry you're having problems integrating it but I released full versions with the integration to the versions you quote and just tested the crash functionality this morning. I received crash reports. It's all working but you may have a local project issue, you may be in debug mode, you may not be on a real device, you may not have uploaded dSYMs, you may not have restarted the app afterwards (to send the report), you may not have waited long enough - it's hard to say. But the module works.

@timomeara
Copy link

Firebase Crashlytics PR just merged! release in progress (CI takes a while). From the perspective of this issue, that means that it is probably more confused as to what we know for sure and what we are guessing on unfortunately, as whatever testing has been performed should be done on the updated crashlytics release.

i'm trying now
i'm using
"@react-native-firebase/analytics": "^7.1.7",
"@react-native-firebase/app": "^8.0.0",
"@react-native-firebase/crashlytics": "^8.0.1",

but still not seeing anything in the console. i'm also not seeing anything in the logs
the previous version was showing entries for my artificially created crash() and non-fatals (recordError) , the detection of previous crashes and data upload start and success.

now i'm no seeing anything except [Firebase/Crashlytics] Version 4.1.1 and the crash()
stepping through in the debugger is see stuff like: FIRCLSSDKLog("Finished recording an exception structure\n");
but it never shows in my logs

@mikehardy
@Aure77

@Aure77
Copy link
Contributor

Aure77 commented Jul 1, 2020

Crashlytics only upload crash report when app start. Did you try to kill/restart app after crash to let Crashlytics sdk to upload things?

@timomeara
Copy link

Crashlytics only upload crash report when app start. Did you try to kill/restart app after crash to let Crashlytics sdk to upload things?

FIXED!!

i had to add the FirebaseCrashlyticsCollectionEnabled key to my info.plist despite enabling it in the js.
for good measure i've also got the analytics key enabled too.
idk if this is a bug, or it's only an issue w/ fabric migrations but maybe something could be added to the docs.

thank you both ( @Aure77 @mikehardy ) for all your help

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

@vanhungoz ^^
enabling debug logging was also very helpful.
for those that are interested: edit your product scheme and add these launch args
-FIRAnalyticsDebugEnabled
-FIRDebugEnabled
Screen Shot 2020-07-01 at 12 25 46 PM

@mikehardy
Copy link
Collaborator

@timomeara

maybe something could be added to the docs.

PRs gratefully accepted 🙏 - there's an edit button top-right of every docs page, Github web UI makes it easy to do docs PRs

@timomeara
Copy link

@timomeara

maybe something could be added to the docs.

PRs gratefully accepted 🙏 - there's an edit button top-right of every docs page, Github web UI makes it easy to do docs PRs

i will absolutely do that @mikehardy but i think i should wait until @Aure77 has a change to look at why
crashlytics().setCrashlyticsCollectionEnabled(true);
appears to have no effect

@vvusts
Copy link

vvusts commented Jul 2, 2020

I also can confirm that logs appear in firebase console (from release on device build) with:

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

Just added this to info.plist

<key>FIREBASE_ANALYTICS_COLLECTION_ENABLED</key>
<true/>
<key>FirebaseCrashlyticsCollectionEnabled</key>
<true/>
rm -rf node_modules/
npm install
cd ios && pod install

@mikehardy
Copy link
Collaborator

I have done no investigation on why I don't need those @vvusts but my project does not have those items in the plist and I received crash traces in the console from my "test crash button"

@benoitvogel
Copy link

Sounds like the problem lies indeed in crashlytics().setCrashlyticsCollectionEnabled(true).

With

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

it works, the crash report appears in the Firebase Console.
When FirebaseCrashlyticsCollectionEnabled is false, it doesn't, even after setCrashlyticsCollectionEnabled(true) has been called.

Release build on a real device, dSYMs are uploaded correctly.

"@react-native-firebase/app": "8.0.0",
"@react-native-firebase/crashlytics": "8.0.1",

I also have "crashlytics_auto_collection_enabled": false, in firebase.json, if that matters. But on Android these exact settings are working properly as I can enable or disable data collection with crashlytics().setCrashlyticsCollectionEnabled(<true/false>) even when disabling automatic collection using

<meta-data
  android:name="firebase_crashlytics_collection_enabled"
  android:value="false" />

in AndroidManifest.xml.

@mikehardy I assume that FirebaseCrashlyticsCollectionEnabled is automatically set to true by default. Setting it to false should prevent automatic data collection on app start, but we are supposed to enable it at runtime (opt-in data collection which is needed for GDPR compliance).

Thanks for your time and hard work.

@mikehardy
Copy link
Collaborator

That probably explains it, I have default settings for boot (which I also am pretty sure are true) rather than toggling them on after. So to narrow that particular issue down, on iOS, it appears that booting with collection false and then toggling it on does not work, which is a bug somewhere (are we calling the APIs correctly in this module? no idea. Is it upstream? no idea)

@pehagg
Copy link
Contributor

pehagg commented Jul 3, 2020

Can confirm that I'm seeing the same behavior as @benoitvogel with iOS, Android works, as stated.

@pehagg
Copy link
Contributor

pehagg commented Jul 3, 2020

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.

@mikehardy
Copy link
Collaborator

Thank you very much for digging in here @pehagg !

@pehagg
Copy link
Contributor

pehagg commented Jul 5, 2020

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.

@mikehardy
Copy link
Collaborator

I copied those research comments to #3879 as we have other researchers posting the foundation info needed for a fix.

I am going to close this as a duplicate because I think the issue here will be fixed by that one. If I'm wrong (happens sadly too often) we can obviously re-open

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

No branches or pull requests

10 participants