expo-firebase-auth, app eject and SDK 32

Hello fellow Exponautes!

I followed Evan Bacon video tutorial on how to eject an app and use firebase cloud messaging for notifications.
Using a clean project I arrive up to this point:

First, my AppDelegate.m looks like this:

// Copyright 2015-present 650 Industries. All rights reserved.

#import "AppDelegate.h"
#import <FirebaseCore/FIROptions.h>
#import <FirebaseCore/FIRApp.h>

@implementation AppDelegate

// Put your app delegate methods here. Remember to also call methods from EXStandaloneAppDelegate superclass
// in order to keep Expo working. See example below.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];

  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

@endesia

Then as soon I add import 'expo-firebase-auth'; to App.js the app fails to build:

import React from 'react';

import { StyleSheet, Text, View } from 'react-native';
import firebase from 'expo-firebase-app';
import 'expo-firebase-auth';

export default class App extends React.Component {
  componentDidMount() {
    console.log(firebase.auth());
  }

I get several errors

[16:24:17] Unable to resolve "expo-firebase-remote-config" from "node_modules/expo-firebase-app/src/utils/getModuleInstance.js"

and the project can’t start.

:confused:

If I install the missing module yarn add expo-firebase-remote-config

The next error is then

Unable to resolve "expo-firebase-crashlytics" from "node_modules/expo-firebase-app/src/utils/getModuleInstance.js"

It like its trying to get all the modules from https://github.com/expo/expo/blob/master/packages/expo-firebase-app/src/utils/getModuleInstance.js

5 Likes

Having the same problem right now. What are you doing to fix it?

No solutions yet. Maybe ejecting to react native without expo…

I had the same problem going through the tutorial today. I don’t know what EXPO or Evan will create for a long term fix, but in the short term, here is what you can do to get your app building without that error.

Go to your node_modules/expo-firebase-app/src/utils/getModuleInstance.js file and comment out all of the Expo-Firebase modules you are not using. Don’t comment get utils. That’s it.

Now restart your server with yarn start or expo start or npm start first and then Run your project from X code second. Your project should now build. Let me know if that works for you.

2 Likes

Got it working! Thank you.

However the data payload after a POST is always empty.

    this.messageListener = firebase.messaging().onMessage(message => {
      // Process your message as required
      console.log(message.data.status);
      console.log(JSON.stringify(message));
      alert('coucou');
    });

{"_data":{},"_from":"588750331458","_messageId":"-LWS6OFhagoVI2Fj1YH5","_ttl":3600}

curl -X POST --header “Authorization: key=AAAxxxxxxxxxxxxxNrJtFe: application/json” https://fcm.googleapis.com/fcm/send -d “{“to”:“cjNg-fBsWsE:APA91bEc-pDmnfkyczdJroTv-KNHpucA7WhYrmxWrgcSz4HHqn5vhodglqI3xxxxxxxxxxxx-YnP8DuxdeHQyp1BUiF-H2V2ockNJ2OO-yEh6Im2EFhI6KHUd3ettEg”,“message”:{“body”:“Test”}}”

Ok I replaced body by data and everything is fine.

Looks like everything is working. Sorry I didn’t see this sooner. Taking another look at it right now though.

I am still getting this error since I haven’t yarn installed all of the firebase modules.

I fix this by commenting out lines in node_modules/expo-firebase-app/src/utils/getModuleInstance.js like rcg suggested.

Is the solution to check if the firebase modules exist before requiring them? Or figure out a way so that only the modules that are used are required?

I am encountering this same problem … seems that this makes it impossible to run the project without crashlytics … this wouldn’t be a problem for me if i was using crashlytics, but i found that i lose the JS stack trace in the crash report which makes it useless … at the risk of hijacking this thread, does anyone have crashlytics working with JS stack traces?

So I upgraded my npm dependencies and I think that fixed the error with requiring uninstalled firebase modules.

But I am now getting an error with “The Expo SDK requires Expo to run.”

I have created a minimal repro repo here: https://github.com/vpontis/expo-firebase-sdk-issue-repro

Same,

We gave up on expo-firebase and moved to https://rnfirebase.io/

I fixed the ““The Expo SDK requires Expo to run.” error!

I am using Expo SDK 32 and instead of modifying expo packages in MainActivity I modified them in MainApplication.

I’m going to clean up my test repo w/ the solution.

There is light at the end of the tunnel!!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.