-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Issue
Recently we added TOTP MFA to our web-app using the Firebase JS SDK. The web-app shares a common firebase project with the react-native firebase project. The react-native project has been building fine but after making the web-app changes now the react-native app crashes on launch with an error alluding to TOTP. We're aware the this library does not currently support TOTP MFA, we have not attempted to implement it in the react-native portion of the project.
The xcode error is
libc++abi: terminating due to uncaught exception of type facebook::jsi::JSError: RNFBAuthModule.getConstants raised an exception: -[FirebaseAuth.TOTPMultiFactorInfo phoneNumber]: unrecognized selector sent to instance 0x105492880
Error: RNFBAuthModule.getConstants raised an exception: -[FirebaseAuth.TOTPMultiFactorInfo phoneNumber]: unrecognized selector sent to instance 0x105492880
at getConstants (native)
at keys (native)
at nativeModuleWrapped (http://172.16.0.9:8081/index.bundle//&platform=ios&dev=true&lazy=true&minify=false&inlineSourceMap=false&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server&{appbundleid}:192817:33)
at initialiseNativeModule (http://172.16.0.9:8081/index.bundle//&platform=ios&dev=true&lazy=true&minify=false&inlineSourceMap=false&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server&{appbundleid}:192866:57)
at getNativeModule (http://172.16.0.9:8081/index.bundle//&platform=ios&dev=true&lazy=true&minify=false&inlineSourceMap=false&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server&{appbundleid}:192931:34)
at get (http://172.16.0.9:8081/index.bundle//&platform=ios&dev=true&lazy=true&minify=false&inlineSourceMap=false&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server&{appbundleid}:193288:64)
at FirebaseAuthModule (http://172.16.0.9:8081/index.bundle//&platform=ios&dev=true&lazy=true&minify=false&inlineSourceMap=false&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server&{appbundleid}:190936:34)
at firebaseModuleWithArgs (http://172.16.0.9:8081/index.bundle//&platform=ios&dev=true&lazy=true&minify=false&inlineSourceMap=false&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server&{appbundleid}:193991:73)
at getAuth (http://172.16.0.9:8081/index.bundle//&platform=ios&dev=true&lazy=true&minify=false&inlineSourceMap=false&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server&{appbundleid}:195639:35)
at getUser (http://172.16.0.9:8081/index.bundle//&platform=ios&dev=true&lazy=true&minify=false&inlineSourceMap=false&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server&{appbundleid}:198026:30)
{...stacktrace cont}
where the javascript invocation of RNFB at the getUser
stacktrace is
import { FirebaseAuthTypes, getAuth } from "@react-native-firebase/auth";
export type User = FirebaseAuthTypes.User;
export function getUser() {
return getAuth().currentUser;
}
I believe this is also happening on Android however I'm unable to debug native logs for the android app but it is crashing on start and unable to attach to the metro bundler.
Project Files
Javascript
Click To Expand
package.json
:
"dependencies": {
"@formatjs/intl-datetimeformat": "^6.5.1",
"@formatjs/intl-getcanonicallocales": "^2.1.0",
"@formatjs/intl-locale": "^3.1.1",
"@formatjs/intl-numberformat": "^8.3.5",
"@formatjs/intl-pluralrules": "^5.1.10",
"@notifee/react-native": "^9.1.8",
"@react-native-async-storage/async-storage": "^1.24.0",
"@react-native-community/slider": "^4.5.5",
"@react-native-firebase/analytics": "^22.1.0",
"@react-native-firebase/app": "^22.2.1",
"@react-native-firebase/auth": "^22.1.0",
"@react-native-firebase/messaging": "^22.1.0",
"@react-native-picker/picker": "^2.3.1",
"@react-navigation/core": "^6.1.0",
"@react-navigation/native": "^6.0.8",
"@react-navigation/native-stack": "^6.2.5",
"@reduxjs/toolkit": "^1.7.1",
"@shopify/flash-list": "^2.0.0-rc.9",
"d3": "^7.3.0",
"expo": "^53.0.11",
"expo-linear-gradient": "~14.1.5",
"expo-web-browser": "~14.2.0",
"i": "^0.3.7",
"intl": "^1.2.5",
"jsonschema": "^1.4.1",
"lottie-react-native": "^7.2.2",
"luxon": "^3.4.0",
"react": "19.0.0",
"react-native": "0.79.3",
"react-native-bootsplash": "^6.3.9",
"react-native-camera-kit": "^15.1.0",
"react-native-color-matrix-image-filters": "^5.2.14",
"react-native-date-picker": "^4.2.9",
"react-native-gesture-handler": "^2.25.0",
"react-native-iap": "^12.16.2",
"react-native-permissions": "^5.4.1",
"react-native-reanimated": "^3.18.0",
"react-native-render-html": "^6.3.4",
"react-native-safe-area-context": "^5.4.1",
"react-native-screens": "^4.11.1",
"react-native-svg": "^15.12.0",
"react-native-url-polyfill": "^2.0.0",
"react-redux": "^7.2.6",
"redux": "^4.1.2",
"semver": "^7.3.7",
"util": "^0.12.5"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "18.0.0",
"@react-native-community/cli-platform-android": "18.0.0",
"@react-native-community/cli-platform-ios": "18.0.0",
"@react-native/babel-preset": "0.79.3",
"@react-native/eslint-config": "0.79.3",
"@react-native/metro-config": "0.79.3",
"@react-native/typescript-config": "0.79.3",
"@rnx-kit/dep-check": "^1.12.20",
"@tsconfig/react-native": "^3.0.0",
"@types/d3": "^7.1.0",
"@types/d3-scale": "^4.0.2",
"@types/jest": "^29.5.13",
"@types/luxon": "^3.3.1",
"@types/react": "19.0.0",
"@types/semver": "^7.3.10",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"babel-loader": "^8.2.3",
"babel-plugin-module-resolver": "^5.0.0",
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
"cross-env": "^7.0.3",
"eslint": "^8.19.0",
"jest": "^26.6.3",
"patch-package": "8.0.0",
"typescript": "5.0.4"
},
firebase.json
for react-native-firebase v6:
{
"react-native": {
"google_analytics_automatic_screen_reporting_enabled": false,
"messaging_android_notification_color": "@color/primary"
}
}
iOS
Click To Expand
ios/Podfile
:
- I'm not using Pods
- I'm using Pods and my Podfile looks like:
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
# react-native-permissions start
def node_require(script)
# Resolve script with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
"require.resolve(
'#{script}',
{paths: [process.argv[1]]},
)", __dir__]).strip
end
node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')
# react-native-permissions end
platform :ios, min_ios_version_supported
prepare_react_native_project!
# react-native-permissions start
# ⬇️ add permissions as needed. See `react-native-permissions` docs for examples
setup_permissions(['Camera', 'Notifications'])
# react-native-permissions end
$RNFirebaseAnalyticsWithoutAdIdSupport=true
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 '{OURAPPNAME}' do
use_expo_modules!
if ENV['EXPO_USE_COMMUNITY_AUTOLINKING'] == '1'
config_command = ['node', '-e', "process.argv=['', '', 'config'];require('@react-native-community/cli').run()"];
else
config_command = [
'node',
'--no-warnings',
'--eval',
'require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo/package.json\')] }))(process.argv.slice(1))',
'react-native-config',
'--json',
'--platform',
'ios'
]
end
config = use_native_modules!(config_command)
use_frameworks! :linkage => :static # react native fire base
$RNFirebaseAsStaticFramework = true # react native fire base
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.swift
:
import UIKit
import Expo
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider
import Firebase // reac†-na†ive-firebase
import RNBootSplash // react-native-bootsplash
@main
class AppDelegate: ExpoAppDelegate {
var window: UIWindow?
var reactNativeDelegate: ReactNativeDelegate?
var reactNativeFactory: RCTReactNativeFactory?
// start: deep link enabling
override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return RCTLinkingManager.application(app, open: url, options: options)
}
// end: deep link enabling
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
// React Native Firebase Add me --- \/
FirebaseApp.configure()
// React Native Firebase Add me --- /\
let delegate = ReactNativeDelegate()
let factory = ExpoReactNativeFactory(delegate: delegate)
delegate.dependencyProvider = RCTAppDependencyProvider()
reactNativeDelegate = delegate
reactNativeFactory = factory
bindReactNativeFactory(factory)
window = UIWindow(frame: UIScreen.main.bounds)
factory.startReactNative(
withModuleName: "{module name}",
in: window,
launchOptions: launchOptions
)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
class ReactNativeDelegate: ExpoReactNativeFactoryDelegate {
// react-native-bootsplash start
func customize(_ rootView: RCTRootView) {
super.customize(rootView)
RNBootSplash.initWithStoryboard("BootSplash", rootView: rootView) // ⬅️ initialize the splash screen
}
// react-native-bootsplash end
override func sourceURL(for bridge: RCTBridge) -> URL? {
// needed to return the correct URL for expo-dev-client.
bridge.bundleURL ?? 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.5
CPU: (8) arm64 Apple M3
Memory: 171.08 MB / 24.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.18.0
path: ~/.nvm/versions/node/v18.18.0/bin/node
Yarn:
version: 1.22.22
path: ~/.nvm/versions/node/v18.18.0/bin/yarn
npm:
version: 9.8.1
path: ~/.nvm/versions/node/v18.18.0/bin/npm
Watchman:
version: 2025.05.26.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/lib/ruby/gems/3.3.0/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:
API Levels:
- "30"
- "31"
- "33"
- "34"
- "35"
Build Tools:
- 30.0.3
- 33.0.0
- 33.0.1
- 33.0.2
- 34.0.0
- 35.0.0
System Images:
- android-35 | AOSP ATD ARM 64
- android-35 | ARM 64 v8a
- android-35 | Google APIs ARM 64 v8a
- android-35 | Pre-Release 16 KB Page Size Google Play ARM 64 v8a
- android-35 | Pre-Release 16 KB Page Size Google APIs ARM 64 v8a
- android-35 | Google APIs ATD ARM 64
- android-36 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2024.3 AI-243.24978.46.2431.13363775
Xcode:
version: 16.2/16C5032a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.14
path: /usr/bin/javac
Ruby:
version: 3.3.0
path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 18.0.0
wanted: 18.0.0
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.79.3
wanted: 0.79.3
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:
- [] 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. 5.4.3
Firebase
module(s) you're using that has the issue:e.g. Instance ID
- Are you using
TypeScript
?Y/N
&VERSION
- 👉 Check out
React Native Firebase
andInvertase
on Twitter for updates on the library.