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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Expo] Error: You attempted to use a firebase module that's not installed on your Android project by calling firebase.app(). #9

Open
KMNowak opened this issue Jul 9, 2021 · 19 comments
Labels
bug Something isn't working

Comments

@KMNowak
Copy link

KMNowak commented Jul 9, 2021

General

What bug do you experience? 馃悶

While using with Expo 42.0.0, calling fetchUser returns:

Error: You attempted to use a firebase module that's not installed on your Android project by calling firebase.app().

How can it be reproduced? 馃

A few steps to define where does the bug occur.
Step 1. Create new app with Expo 42.
Step 2. Create project in Firebase and add it to the application.
Step 3. Sign in (e.g. Anonymously), get user and try call fetchUser(firebaseUser.uid)

What behavior is expected? 馃挕

The method fetchUser should be called correctly.


Extras

Code snippets 馃摑

Minimum example:

import React, { useEffect } from 'react'
import firebase from 'firebase'
import { createUserInFirestore, fetchUser } from '@flyerhq/react-native-firebase-chat-core'
import { firebaseConfig } from './config'

const MyComponent = () => {
   useEffect(() => {
      firebase.initializeApp(firebaseConfig)

      const firebaseUser = firebase.auth().currentUser

     if (!firebaseUser) {
       firebase.auth().signInAnonymously()
         .then(newUser =>newUser &&  fetchUser(newUser.uid) // <-- here throws below error
     }
   }, [])


   return (
    <View><Text>Sample</Text></View>
   ) 
}

Environment info

Please specify the react, react-native, react-native-firebase-chat-core versions.

react: 16.13.1
react-native: https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz
react-native-firebase-chat-core: 1.0.1

npx react-native info output 馃憞

System:
    OS: macOS 11.4
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 667.56 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.12.1 - ~/.nvm/versions/node/v12.13.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.8.4 - /usr/local/bin/pod
  SDKs:
    iOS SDK: Not Found
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3
      System Images: android-28 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.3 AI-182.5107.16.33.5264788
    Xcode: /undefined - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_201 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz => 0.63.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Platform

Device: sm-g781b

OS version Android 11


@KMNowak KMNowak added the bug Something isn't working label Jul 9, 2021
@KMNowak KMNowak changed the title [Expo [Expo] In progress.. Jul 9, 2021
@cristaloleg
Copy link
Member

Looks like issue is missing some details, can you add?

@KMNowak
Copy link
Author

KMNowak commented Jul 9, 2021

Sorry, I accidentally hit enter. Now it's complete :)

@KMNowak KMNowak changed the title [Expo] In progress.. [Expo] Error: You attempted to use a firebase module that's not installed on your Android project by calling firebase.app(). Jul 12, 2021
@KMNowak
Copy link
Author

KMNowak commented Jul 12, 2021

Now it's complete. I'll be grateful if you can give some insights what can be changed to make it work.

@aaryashahk
Copy link

aaryashahk commented Jul 26, 2021

Having the same issue. Correct me if I am wrong, but I believe it has something to do with FlyerChat using the React Native Firebase dependency, separate from the Firebase JS SDK, which is not usable on the managed workflow utilized by Expo.

@demchenkoalex
Copy link
Member

Oops completely missed that! We are working on a big update for React Native with new features and Firebase package will be updated too. I will take a look at Expo too.

@aaryashahk
Copy link

aaryashahk commented Jul 27, 2021

Oops completely missed that! We are working on a big update for React Native with new features and Firebase package will be updated too. I will take a look at Expo too.

When can we expect this update? And in the meantime, is there anything developers using Expo's managed workflow can do?

@demchenkoalex
Copy link
Member

@aaryashahk I have never used Expo before, so I can't suggest anything. PR with an update is already in the UI repo, I just need to find some time to review it, so in the near future.

@aaryashahk
Copy link

@aaryashahk I have never used Expo before, so I can't suggest anything. PR with an update is already in the UI repo, I just need to find some time to review it, so in the near future.

I understand. Does this PR with the update that's already in the UI repo have the capability of working with Firebase in Expo's managed workflow?

@demchenkoalex
Copy link
Member

@aaryashahk UI and Firebase are not related packages. We separated them completely in order for people to use whatever they want, not requiring the other part. From what I know UI has no problems with Expo whatsoever.

@aaryashahk
Copy link

@aaryashahk UI and Firebase are not related packages. We separated them completely in order for people to use whatever they want, not requiring the other part. From what I know UI has no problems with Expo whatsoever.

Yes, UI works perfectly fine on Expo. Incorporating Firebase is the problem in Expo since FlyerChat is using react-native-firebase, which is not compatible with Expo's managed workflow. Are you going to add support for FlyerChat's Firebase BaaS to work on Expo's managed workflow?

@demchenkoalex
Copy link
Member

@aaryashahk you are saying that Expo does not support react-native-firebase? That means we will not add this support, because this is the only library we can use for RN

@gwbischof
Copy link

gwbischof commented Dec 14, 2021

I think that expo supports react-native-firebase
https://docs.expo.dev/guides/setup-native-firebase/#bare-workflow-setup

@demchenkoalex
Copy link
Member

It should work in a bare workflow anyway? The question was about managed workflow I suppose. To do that I will need to rewrite everything using JS SDK.

@hirbod
Copy link

hirbod commented Jan 12, 2022

It also works now with the managed workflow using custom dev clients and expo config plugins.

@lalitdhimaney
Copy link

It also works now with the managed workflow using custom dev clients and expo config plugins.

Hi, @hirbod I am using expo managed workflow and was trying to implement Firebase messaging but getting the same error "Error: You attempted to use a firebase module that's not installed on your Android project by calling firebase.app()." Can you please let me know what specific steps you took while implementing?
Link: https://rnfirebase.io/messaging/notifications
Expo SDK: 47, React Native: 0.70.8, react-native-firebase/app: 18.1.0, react-native-firebase/messaging: 18.1.0

@Noothan-am
Copy link

hey @KMNowak, did you get any solution to fix it ?

@KMNowak
Copy link
Author

KMNowak commented Sep 1, 2023

hey @KMNowak, did you get any solution to fix it ?

Unfortunately not, I was applying that to PoCs I was building and gave this specific one up. Anyway, I hope someone will find a solution, so you will get unstuck.

@cryptodev6
Copy link

Has anyone fixed it? I keep having the same trouble for a long time

@demchenkoalex
Copy link
Member

please don't use this package @cryptodev6 - not maintained for a very long time. Just keeping it as a placeholder in case I will be able to return to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants