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

[🐛] Type mismatch between initializeApp return value and getAuth variable #8098

Open
1 of 10 tasks
aaroncraigongithub opened this issue Oct 29, 2024 · 1 comment
Open
1 of 10 tasks
Labels
Needs Attention tools: typings TypeScript / Flow type: bug New bug report

Comments

@aaroncraigongithub
Copy link

aaroncraigongithub commented Oct 29, 2024

Issue

The following code snippet triggers Typescript errors:

import { initializeApp } from "@react-native-firebase/app";
import { getAuth } from "@react-native-firebase/auth";

const firebaseConfig = { ... };
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);

The issue is that initializeApp returns a ReactNativeFirebase.FirebaseApp while getAuth wants a FirebaseApp as defined in fiirebase/app-types.

The first has an extra utils() property, and is missing a required automaticDataCollectionEnabled property expected by the auth module.

This is in a ReactNative (expo) project, where I am building for both native and web.

Project Files

Javascript

Click To Expand

package.json:

    "@react-native-firebase/app": "^21.2.0",
    "@react-native-firebase/auth": "^21.2.0",
    "firebase": "^11.0.1",

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:
# N/A

AppDelegate.m:

// 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
  • 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


@aaroncraigongithub
Copy link
Author

I discovered that the following seems to solve the issue for now:

getAuth({ ...app, automaticDataCollectionEnabled: false });

@mikehardy mikehardy added the tools: typings TypeScript / Flow label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Attention tools: typings TypeScript / Flow type: bug New bug report
Projects
None yet
Development

No branches or pull requests

2 participants