Skip to content

🔥 Functions crash in IOS Release Mode only #8369

Open
@PL47productions

Description

Issue

Describe your issue here
In my IOS project, when making a call to firebase functions in Release mode, I am encountering -[NSNull length]: unrecognized selector error.

Interestingly, the call works fine when running in Debug mode on IOS. On Android, everything works correctly in both Debug and Release modes. I'll also note that authorization calls and calls to firestore work fine in both release and debug mode for both platforms.

In the "JavaScript" section of the provided bug reporting template, I included the simple function call that is triggering the error.

The crash logs do not provide a lot of detail and I have spent numerous hours trying to figure out what is happening, with no luck.

The only error I receive:
"libc++abi: terminating due to uncaught exception of type facebook::jsi::JSError: Exception in HostFunction: -[NSNull length]: unrecognized selector sent to instance 0x1e4877140

Error: Exception in HostFunction: -[NSNull length]: unrecognized selector sent to instance 0x1e4877140"

Additionally, Xcode indicates the (red) X next to Thread 2 Queue : com.meta.react.turbomodulemanager.queue (serial)

The crash logs do not point to any particular line, but I did see that within the functions library/pod, the Functions file on line 486 the does point to an NSNull() variable:
let data = data ?? NSNull()

Just a wild guess at this point, no idea. Please advise, thanks.


Project Files

Javascript

export async function getFastFinAccountsHelper(id){ try{
  let retrieveBalances = functions().httpsCallable('getAccounts');      
  let finAccountsArray = await retrieveBalances({customerId: id}).then(function(result) {
    return result.data.accounts;
  }).catch(() => {
    return []
  })

  return finAccountsArray;

 
}catch(e){
  uploadError(e.message)
}

}

package.json:

# N/A

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'budgeteven' do
  config = use_native_modules!
  use_frameworks! :linkage => :static
  $RNFirebaseAsStaticFramework = true

  use_react_native!(
    :path => config[:reactNativePath],
  
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      # :ccache_enabled => true
    )
  end
end

AppDelegate.m:

import UIKit
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider
import FirebaseCore



@main
class AppDelegate: RCTAppDelegate {
  override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
    self.moduleName = "budgeteven"
    self.dependencyProvider = RCTAppDependencyProvider()
    FirebaseApp.configure()
    // 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)
  }

  override func sourceURL(for bridge: RCTBridge) -> URL? {
    self.bundleURL()
  }

  override func bundleURL() -> URL? {
#if DEBUG
    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }
}


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:

System:
  OS: macOS 15.3.1
  CPU: (12) x64 Apple M2 Max
  Memory: 329.85 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.17.1
    path: /usr/local/bin/node
  Yarn: Not Found
  npm:
    version: 9.6.7
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23726.103.2422.13016713
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.77.1
    wanted: 0.77.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
  • Platform that you're experiencing the issue on:
    • [x ] iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue:
    • e.g. 21.11.0
  • Firebase module(s) you're using that has the issue:
    • @react-native-firebase/functions
  • Are you using TypeScript?
    • N


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions