Skip to content

[πŸ›] Missing required module 'FirebaseFirestoreInternalWrapper' when building app with widget.Β #8548

Closed
@wneel

Description

@wneel

Issue

TLDR;
I wonder if there is any good way to add the Firebase sdk in an app extension while using RNFB in the main App ?

Steps to reproduce:

  1. create a react native app that uses RNFB with Auth and Firestore
  2. In Xcode add an app extension (a wdiget)
  3. Add the firebase-ios-sdk to the Packages of the project, then add Auth and Firestore to the "Frameworks and Libraries" of the widget
  4. get Missing required module 'FirebaseFirestoreInternalWrapper' when building the app (from xcode or CLI)

Full story:
My app depend on RNFB and everything is working fine. I added a Widget on iOS an "App Extension" on xcode, I want to use FirebaseFirestore in the widget to make requests, I use FirebaseAuth aswell to check if the users is logged in the app via userAccessGroup.

Everything was working fine until two days ago after I cleaned build cache i'ts now impossible to make it work again, what I do and what I tried:

I use the FirebaseFirestore and FirebaseAuth from the firebase-ios-sdk(version 11.11) that I imported in Frameworks and Libraries in the Widget target,

When I build like that I have now the following error:

Missing required module 'FirebaseFirestoreInternalWrapper'

If I try to add FirebaseFirestore from the firebase-ios-sdk in the App target I then get this error:

Redefinition of module 'Firebase' // 4 times
Redefinition of module 'FirebaseCore' 
Could not build Objective-C module 'RNFBAppCheck'

Wich seems logical to me, I tried to remove the declaration of the module in the FirebaseFirestore I add in the app target, then it say it miss FirebaseAuth, and after adding it and do the same process I get a lot of duplicate symbol (I know this is not a viable solution, it's just to give more context)

So I wonder if there is any good way to add the Firebase sdk in an app extension while using RNFB in the main App, I really tried to search around but didn't found any data..

The frustrating part is that it was working perfectly before cleaning the build cache, I tried with multiple firebase-ios-sdk versions but that didn't change anything


Project Files

Javascript

Click To Expand

package.json:

{
	"dependencies": {
		"@notifee/react-native": "^9.1.8",
		"@quidone/react-native-wheel-picker": "^1.4.0",
		"@react-native-async-storage/async-storage": "^2.1.2",
		"@react-native-community/geolocation": "^3.4.0",
		"@react-native-firebase/analytics": "^21.14.0",
		"@react-native-firebase/app": "^21.14.0",
		"@react-native-firebase/app-check": "^21.14.0",
		"@react-native-firebase/auth": "^21.14.0",
		"@react-native-firebase/crashlytics": "^21.14.0",
		"@react-native-firebase/firestore": "^21.14.0",
		"@react-native-firebase/messaging": "^21.14.0",
		"@react-native-firebase/storage": "^21.14.0",
		"@react-native-masked-view/masked-view": "^0.3.2",
		"@react-navigation/bottom-tabs": "^7.3.10",
		"@react-navigation/native": "^7.1.6",
		"@react-navigation/stack": "^7.2.10",
		"fuse.js": "^7.1.0",
		"geofire-common": "^6.0.0",
		"react": "^19.0.0",
		"react-native": "^0.79.1",
		"react-native-android-widget": "^0.15.1",
		"react-native-blob-util": "^0.21.2",
		"react-native-date-picker": "^5.0.12",
		"react-native-edge-to-edge": "^1.6.0",
		"react-native-gesture-handler": "^2.25.0",
		"react-native-get-device-locale": "^0.3.0",
		"react-native-image-crop-picker": "^0.42.0",
		"react-native-maps": "^1.20.1",
		"react-native-reanimated": "^3.17.4",
		"react-native-safe-area-context": "^5.4.0",
		"react-native-screens": "^4.10.0",
		"react-native-share": "^12.0.9",
		"react-native-svg": "^15.11.2",
		"react-native-view-shot": "^4.0.3"
	},
	"devDependencies": {
		"@babel/core": "^7.26.10",
		"@babel/preset-env": "^7.26.9",
		"@babel/preset-typescript": "^7.27.0",
		"@babel/runtime": "^7.27.0",
		"@firebase/rules-unit-testing": "^4.0.1",
		"@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-community/cli-server-api": "^18.0.0",
		"@react-native/babel-preset": "^0.79.1",
		"@react-native/metro-config": "^0.79.1",
		"@react-native/typescript-config": "^0.79.1",
		"@types/jest": "^29.5.14",
		"@types/node": "^22.14.1",
		"@types/react": "^19.0.10",
		"@types/react-test-renderer": "^19.0.0",
		"babel-jest": "^29.7.0",
		"babel-plugin-module-resolver": "^5.0.2",
		"babel-plugin-transform-remove-console": "^6.9.4",
		"detox": "^20.36.5",
		"firebase-admin": "^13.2.0",
		"globals": "^16.0.0",
		"jest": "^29.7.0",
		"react-native-dotenv": "^3.4.11",
		"react-test-renderer": "^19.0.0",
		"ts-jest": "^29.3.2",
		"typescript": "5.8.3"
	},
	"engines": {
		"node": ">=18"
	}
}

firebase.json for react-native-firebase v6:

{
	"firestore": {
		"rules": "firestore.rules",
		"indexes": "firestore.indexes.json"
	},
	"functions": [
		{
			"source": "functions/functions",
			"codebase": "default",
			"ignore": [
				"node_modules",
				".git",
				"firebase-debug.log",
				"firebase-debug.*.log"
			],
			"predeploy": [
				"npm --prefix \"$RESOURCE_DIR\" run build"
			]
		}
	],
	"storage": {
		"rules": "storage.rules"
	},
	"emulators": {
		"auth": {
			"port": 9099
		},
		"firestore": {
			"port": 8080
		},
		"storage": {
			"port": 9199
		},
		"functions": {
			"port": 5001
		},
		"ui": {
			"enabled": true
		},
		"singleProjectMode": true
	},
	"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:
# Resolve react_native_pods.rb with node to allow for hoisting
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 'Animalert' do
  config = use_native_modules!
	use_frameworks! :linkage => :static
	$RNFirebaseAsStaticFramework = true
	$RNFirebaseAnalyticsWithoutAdIdSupport=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|
		installer.pods_project.targets.each do |target|
			target.build_configurations.each do |config|
				config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
			end
		end #https://github.com/invertase/react-native-firebase/issues/7127
    # 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:

AppDelegate.swift:

import UIKit
import RNFBAppCheck
import FirebaseCore
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
	var window: UIWindow?

  var reactNativeDelegate: ReactNativeDelegate?
  var reactNativeFactory: RCTReactNativeFactory?

  func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
  ) -> Bool {
		RNFBAppCheckModule.sharedInstance()
		FirebaseApp.configure()
    let delegate = ReactNativeDelegate()
    let factory = RCTReactNativeFactory(delegate: delegate)
    delegate.dependencyProvider = RCTAppDependencyProvider()

    reactNativeDelegate = delegate
    reactNativeFactory = factory

    window = UIWindow(frame: UIScreen.main.bounds)

    factory.startReactNative(
      withModuleName: "Animalert",
      in: window,
      launchOptions: launchOptions
    )

    return true
  }
}

class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
  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:

info Fetching system and libraries information...
System:
  OS: macOS 15.5
  CPU: (10) arm64 Apple M2 Pro
  Memory: 267.20 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.14.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.22
    path: /usr/local/bin/yarn
  npm:
    version: 11.4.0
    path: /usr/local/bin/npm
  Watchman:
    version: 2025.05.26.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.4
      - iOS 18.4
      - macOS 15.4
      - tvOS 18.4
      - visionOS 2.4
      - watchOS 11.4
  Android SDK:
    API Levels:
      - "27"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 33.0.1
      - 34.0.0
      - 35.0.0
    System Images:
      - android-27 | ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11255304
  Xcode:
    version: 16.3/16E140
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.0
    wanted: ^18.0.0
  react:
    installed: 19.1.0
    wanted: ^19.0.0
  react-native:
    installed: 0.79.2
    wanted: ^0.79.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:
    • 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.14.0
  • Firebase module(s) you're using that has the issue:
    • FirebaseCore
    • FirebaseFirestore
    • FirebaseAuth
  • Are you using TypeScript?
    • Y & 5.8.3


Metadata

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