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.7k stars 2.22k forks source link

[🐛] iOS App crashing at runtime due to Firebase configuration issues #7583

Closed manuelquezada23 closed 9 months ago

manuelquezada23 commented 9 months ago

Issue

When I run npx expo run:ios --configuration Release, the app crashes at runtime. Note that this does not happen when running the app in the dev environment.

This is what the crash log looks like:

Last Exception Backtrace:
0   CoreFoundation                         0x180437324 __exceptionPreprocess + 160
1   libobjc.A.dylib                        0x180051274 objc_exception_throw + 56
2   Cinemates                              0x101104954 RCTFormatError + 0
3   Cinemates                              0x100f48c0c -[RCTExceptionsManager reportFatal:stack:exceptionId:extraDataAsJSON:] + 488
4   Cinemates                              0x100f49440 -[RCTExceptionsManager reportException:] + 1292
5   CoreFoundation                         0x18043d6c0 __invoking___ + 144
6   CoreFoundation                         0x18043aa44 -[NSInvocation invoke] + 276
7   CoreFoundation                         0x18043acdc -[NSInvocation invokeWithTarget:] + 60
8   Cinemates                              0x1011336f0 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 388
9   Cinemates                              0x101135740 facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&, int, (anonymous namespace)::SchedulingContext) + 456
10  Cinemates                              0x101135390 invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) + 112
11  libdispatch.dylib                      0x180132ee4 _dispatch_call_block_and_release + 24
12  libdispatch.dylib                      0x180134708 _dispatch_client_callout + 16
13  libdispatch.dylib                      0x18013c77c _dispatch_lane_serial_drain + 776
14  libdispatch.dylib                      0x18013d3dc _dispatch_lane_invoke + 392
15  libdispatch.dylib                      0x180149608 _dispatch_workloop_worker_thread + 768
16  libsystem_pthread.dylib                0x1b1834878 _pthread_wqthread + 284
17  libsystem_pthread.dylib                0x1b183363c start_wqthread + 8

Thread 0::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib                 0x1b17dc190 mach_msg2_trap + 8
1   libsystem_kernel.dylib                 0x1b17ed258 mach_msg2_internal + 76
2   libsystem_kernel.dylib                 0x1b17e4398 mach_msg_overwrite + 540
3   libsystem_kernel.dylib                 0x1b17dc500 mach_msg + 20
4   CoreFoundation                         0x18039a4a8 __CFRunLoopServiceMachPort + 156
5   CoreFoundation                         0x180394ad4 __CFRunLoopRun + 1128
6   CoreFoundation                         0x180394254 CFRunLoopRunSpecific + 584
7   GraphicsServices                       0x188eb7c9c GSEventRunModal + 160
8   UIKitCore                              0x102eb2ff0 -[UIApplication _run] + 868
9   UIKitCore                              0x102eb6f3c UIApplicationMain + 124
10  Cinemates                              0x100f3c3dc main + 80 (main.m:7)
11  dyld_sim                               0x101db9514 start_sim + 20
12  dyld                                   0x101f39f28 start + 2236

Thread 1 Crashed::  Dispatch queue: com.facebook.react.ExceptionsManagerQueue
0   libsystem_kernel.dylib                 0x1b17e3fa8 __pthread_kill + 8
1   libsystem_pthread.dylib                0x1b183812c pthread_kill + 256
2   libsystem_c.dylib                      0x18012873c abort + 124
3   libc++abi.dylib                        0x18023d0a8 abort_message + 128
4   libc++abi.dylib                        0x18022dbd4 demangling_terminate_handler() + 300
5   libobjc.A.dylib                        0x180032ea8 _objc_terminate() + 124
6   libc++abi.dylib                        0x18023c580 std::__terminate(void (*)()) + 12
7   libc++abi.dylib                        0x18023c530 std::terminate() + 52
8   libdispatch.dylib                      0x18013471c _dispatch_client_callout + 36
9   libdispatch.dylib                      0x18013c77c _dispatch_lane_serial_drain + 776
10  libdispatch.dylib                      0x18013d3dc _dispatch_lane_invoke + 392
11  libdispatch.dylib                      0x180149608 _dispatch_workloop_worker_thread + 768
12  libsystem_pthread.dylib                0x1b1834878 _pthread_wqthread + 284
13  libsystem_pthread.dylib                0x1b183363c start_wqthread + 8

Thread 2:
0   libsystem_pthread.dylib                0x1b1833634 start_wqthread + 0

Thread 3:
0   libsystem_pthread.dylib                0x1b1833634 start_wqthread + 0

Thread 4:
0   libsystem_pthread.dylib                0x1b1833634 start_wqthread + 0

Thread 5:: com.apple.uikit.eventfetch-thread
0   libsystem_kernel.dylib                 0x1b17dc190 mach_msg2_trap + 8
1   libsystem_kernel.dylib                 0x1b17ed258 mach_msg2_internal + 76
2   libsystem_kernel.dylib                 0x1b17e4398 mach_msg_overwrite + 540
3   libsystem_kernel.dylib                 0x1b17dc500 mach_msg + 20
4   CoreFoundation                         0x18039a4a8 __CFRunLoopServiceMachPort + 156
5   CoreFoundation                         0x180394ad4 __CFRunLoopRun + 1128
6   CoreFoundation                         0x180394254 CFRunLoopRunSpecific + 584
7   Foundation                             0x180b994bc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 208
8   Foundation                             0x180b996e0 -[NSRunLoop(NSRunLoop) runUntilDate:] + 60
9   UIKitCore                              0x102f52714 -[UIEventFetcher threadMain] + 404
10  Foundation                             0x180bbede0 __NSThread__start__ + 704
11  libsystem_pthread.dylib                0x1b1838428 _pthread_start + 116
12  libsystem_pthread.dylib                0x1b1833648 thread_start + 8

Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "cinemates", "version": "1.0.0", "scripts": { "start": "expo start --dev-client", "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web", "eject": "expo eject" }, "dependencies": { "@cloudinary/react": "^1.11.2", "@cloudinary/url-gen": "^1.16.0", "@expo-google-fonts/plus-jakarta-sans": "^0.2.3", "@expo/image-utils": "^0.3.23", "@fawazahmed/react-native-read-more": "^3.0.3", "@react-native-community/netinfo": "9.3.10", "@react-native-firebase/app": "^18.7.3", "@react-native-firebase/messaging": "^18.7.3", "@react-navigation/bottom-tabs": "^6.5.11", "@react-navigation/native": "^6.1.9", "@react-navigation/native-stack": "^6.9.17", "@react-navigation/stack": "^6.3.20", "@rneui/base": "^4.0.0-rc.1", "@rneui/themed": "^4.0.0-rc.1", "axios": "^1.6.5", "axios-auth-refresh": "^3.3.6", "babel-preset-expo": "^9.9.0", "buffer": "^6.0.3", "cloudinary": "^1.41.3", "core-js": "^3.35.1", "expo": "^49.0.22", "expo-app-loading": "^2.1.1", "expo-build-properties": "^0.8.3", "expo-constants": "~14.4.2", "expo-device": "~5.4.0", "expo-font": "^11.10.2", "expo-image-picker": "~14.3.2", "expo-secure-store": "~12.3.1", "expo-splash-screen": "^0.20.5", "expo-status-bar": "~1.6.0", "imgbb-uploader": "^1.5.1", "ionicons": "^7.2.2", "jwt-decode": "^4.0.0", "moment": "^2.30.1", "patch-package": "^8.0.0", "react": "18.2.0", "react-dom": "18.2.0", "react-native": "0.72.6", "react-native-above-keyboard": "^1.3.0", "react-native-confirmation-code-field": "^7.3.2", "react-native-deck-swiper": "^2.0.16", "react-native-fast-image": "^8.6.3", "react-native-gesture-handler": "~2.12.0", "react-native-global-props": "^1.1.5", "react-native-ionicons": "^4.6.5", "react-native-keychain": "^8.1.2", "react-native-paper": "^4.12.8", "react-native-raw-bottom-sheet": "^2.2.0", "react-native-read-more": "^1.0.0", "react-native-read-more-text": "^1.1.2", "react-native-reanimated": "~3.3.0", "react-native-safe-area-context": "4.6.3", "react-native-screens": "~3.22.0", "react-native-section-alphabet-list": "^3.0.0", "react-native-stars": "^1.2.2", "react-native-swipe-cards": "^0.1.1", "react-native-vector-icons": "^10.0.3", "react-native-web": "^0.19.10", "react-navigation": "5.0.0", "react-navigation-stack": "^2.10.4", "react-tinder-card": "^1.6.4", "rn-fetch-blob": "^0.12.0" }, "devDependencies": { "@babel/core": "^7.23.7", "@notifee/react-native": "^7.8.2" }, "private": true } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking") require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods") require 'json' podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {} ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0' ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR'] platform :ios, podfile_properties['ios.deploymentTarget'] || '13.0' install! 'cocoapods', :deterministic_uuids => false prepare_react_native_project! # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set. # because `react-native-flipper` depends on (FlipperKit,...), which will be excluded. To fix this, # you can also exclude `react-native-flipper` in `react-native.config.js` # # ```js # module.exports = { # dependencies: { # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}), # } # } # ``` flipper_config = FlipperConfiguration.disabled if ENV['NO_FLIPPER'] == '1' then # Explicitly disabled through environment variables flipper_config = FlipperConfiguration.disabled elsif podfile_properties.key?('ios.flipper') then # Configure Flipper in Podfile.properties.json if podfile_properties['ios.flipper'] == 'true' then flipper_config = FlipperConfiguration.enabled(["Debug", "Release"]) elsif podfile_properties['ios.flipper'] != 'false' then flipper_config = FlipperConfiguration.enabled(["Debug", "Release"], { 'Flipper' => podfile_properties['ios.flipper'] }) end end target 'Cinemates' do use_expo_modules! config = use_native_modules! use_frameworks! :linkage => :static $RNFirebaseAsStaticFramework = true use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks'] use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS'] # Flags change depending on the env values. flags = get_default_flags() use_react_native!( :path => config[:reactNativePath], :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes', :fabric_enabled => flags[:fabric_enabled], # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/..", # Note that if you have use_frameworks! enabled, Flipper will not work if enabled :flipper_configuration => flipper_config ) post_install do |installer| react_native_post_install( installer, config[:reactNativePath], :mac_catalyst_enabled => false ) __apply_Xcode_12_5_M1_post_install_workaround(installer) # This is necessary for Xcode 14, because it signs resource bundles by default # when building for devices. installer.target_installation_results.pod_target_installation_results .each do |pod_name, target_installation_result| target_installation_result.resource_bundle_targets.each do |resource_bundle_target| resource_bundle_target.build_configurations.each do |config| config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' end end end end post_integrate do |installer| begin expo_patch_react_imports!(installer) rescue => e Pod::UI.warn e end end end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import #import #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [FIRApp configure]; self.moduleName = @"main"; // You can add your custom initial props in the dictionary below. // They will be passed down to the ViewController used by React Native. self.initialProps = @{}; return [super application:application didFinishLaunchingWithOptions:launchOptions]; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@".expo/.virtual-metro-entry"]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } // Linking API - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options { return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options]; } // Universal Links - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler { BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result; } // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { return [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { return [super application:application didFailToRegisterForRemoteNotificationsWithError:error]; } // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { return [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; } @end ```


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:** ``` System: OS: macOS 13.4.1 CPU: (12) arm64 Apple M2 Pro Memory: 41.38 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 16.20.1 path: ~/.nvm/versions/node/v16.20.1/bin/node Yarn: Not Found npm: version: 8.19.4 path: ~/.nvm/versions/node/v16.20.1/bin/npm Watchman: Not Found Managers: CocoaPods: version: 1.14.3 path: /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 22.4 - iOS 16.4 - macOS 13.3 - tvOS 16.4 - watchOS 9.4 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: version: 14.3.1/14E300c path: /usr/bin/xcodebuild Languages: Java: version: 21.0.1 path: /usr/bin/javac Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.6 wanted: 0.72.6 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: false newArchEnabled: false ``` - **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - 5.6.0 - **Are you using `TypeScript`?** - No


mikehardy commented 9 months ago

Nothing in the stack trace points to firebase-ios-sdk or react-native-firebase