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

Error with @react-native-firebase/auth and Expo: "does not contain a valid config plugin" #5629

Closed
Madhav-Malhotra opened this issue Aug 21, 2021 · 6 comments

Comments

@Madhav-Malhotra
Copy link

Madhav-Malhotra commented Aug 21, 2021

I'm trying to add @react-native-firebase/auth to a standard Expo template. I have followed all instructions in the documentation here. But I get this error:

Package "@react-native-firebase/auth" does not contain a valid config plugin.
Learn more: https://docs.expo.io/guides/config-plugins/#creating-a-plugin

Cannot use import statement outside a module

Steps to Reproduce

  1. Install Expo CLI and initialise a template project. When it asks for the type of template, just hit Enter to select the default Javascript app with one screen.
npm i -g expo
expo init my-project
cd ./my-project
  1. Install @react-native-firebase/app and @react-native-firebase/auth
    npm i @react-native-firebase/app @react-native-firebase/auth

  2. Create a Firebase project and add an Android app and an IOS app. Download config files for both (google-services.json and GoogleService-Info.plist). Place these files in the root folder (./my-project)

  3. Add the specified app.json configuration from the documentation.

{
  "expo": {
    "android": {
      "googleServicesFile": "./google-services.json"
    },
    "ios": {
      "googleServicesFile": "./GoogleService-Info.plist"
    },
    "plugins": [
      "@react-native-firebase/app",
      "@react-native-firebase/auth"
    ]
  }
}
  1. Prebuild the app, starting with Android.
    expo run:android

You should see the error pop up.

Package "@react-native-firebase/auth" does not contain a valid config plugin.
Learn more: https://docs.expo.io/guides/config-plugins/#creating-a-plugin

Cannot use import statement outside a module

Here are my package versions

Package.json

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@react-native-firebase/app": "^12.7.1",
    "@react-native-firebase/auth": "^12.7.1",
    "expo": "~42.0.1",
    "expo-status-bar": "~1.0.4",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
    "react-native-web": "~0.13.12"
  },
  "devDependencies": {
    "@babel/core": "^7.9.0"
  },
  "private": true
}

app.json

{
  "expo": {
    "name": "sprint-tracker",
    "slug": "sprint-tracker",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true,
      "googleServicesFile": "./GoogleService-Info.plist"
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      },
      "googleServicesFile": "./google-services.json"
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
    "plugins": [
      "@react-native-firebase/app",
      "@react-native-firebase/auth"
    ]
  }
}

I have node v14.17.4

What I've tried to debug

  • I've tried downgrading @react-native-firebase/app and @react-native-firebase/app to ^12.6.1
  • I've tried deleting the entire ./my-project folder and initialising a new app
  • I also saw the same error message in a forum about react-native-vision-camera. Someone commented how there was an issue with Expo 41 and 42. It said to modify the 'user podfile'. I'm just trying react-native-firebase for the first time, so I don't understand what they mean :/
@mikehardy
Copy link
Collaborator

Hi there, Expo support has been contributed by the community, if auth needs a config plugin and doesn't have one, then you will either need to make one (like so #5480), wait until someone does, or use a different workflow.

I wasn't under the impression that auth needed a config plugin though? Does it @barthap ?

@barthap
Copy link
Contributor

barthap commented Aug 21, 2021

As far as I know, the Auth module does not need any custom installation steps. It implies that it doesn't need config plugin to work with Expo.

According to the docs:

Config plugins are only required for React Native Firebase modules, which require custom native installation steps - e.g. modifying the Xcode project, Podfile, build.gradle, AndroidManifest.xml etc. Packages without native steps required will work out of the box.

Just remove the auth from plugins list in app.json and you should be OK.

@Madhav-Malhotra
Copy link
Author

@mikehardy This works, thank you! Quick question: which of the react-native-firebase modules do we need to add to plugins in app.json? I saw these ones in the documentation

  • @react-native-firebase/app
  • @react-native-firebase/perf
  • @react-native-firebase/crashlytics

@mikehardy
Copy link
Collaborator

Just those one for normal usage. Basically, if you read in the instructions that you need to add something in AppDelegate.m or build.gradle, it needs a plugin. I just added the App Check module here, and for debug/CI only you may wish to add something in AppDelegate but as it's new and Expo has been very helpfully contributed by @barthap before App Check existed, it does not have a plugin yet.

@danieldanielecki
Copy link

As far as I know, the Auth module does not need any custom installation steps. It implies that it doesn't need config plugin to work with Expo.

According to the docs:

Config plugins are only required for React Native Firebase modules, which require custom native installation steps - e.g. modifying the Xcode project, Podfile, build.gradle, AndroidManifest.xml etc. Packages without native steps required will work out of the box.

Just remove the auth from plugins list in app.json and you should be OK.

Same applies to @react-native-firebase/analytics :)

@ramikhoualdi
Copy link

As far as I know, the Auth module does not need any custom installation steps. It implies that it doesn't need config plugin to work with Expo.

According to the docs:

Config plugins are only required for React Native Firebase modules, which require custom native installation steps - e.g. modifying the Xcode project, Podfile, build.gradle, AndroidManifest.xml etc. Packages without native steps required will work out of the box.

Just remove the auth from plugins list in app.json and you should be OK.

it worked for me. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants