4
import React, { Component } from 'react';
import RNFirebase from 'react-native-firebase';


const firebase = RNFirebase.initializeApp({
    apiKey: 'KEY',
    authDomain: 'APPNAME.firebaseapp.com',
    databaseURL: 'https://APPNAME-#####.firebaseio.com/',
    projectId: 'APPNAME-#####'});

export default firebase;

This is my code (with replacements obviously) I've added the required pods and the GoogleService-Info.plist file also.

I'm getting the error

"Failed to initialize app. FirebaseOptions missing or invalid "appID" property"

Does anyone know why this might be the case?

1 Answer 1

3

If you have set up your application properly, you do not need to do a second initializeApp as that is done for you automatically. You should just import firebase and be on your merry way per the documentation.

If what you are trying to do is to do multiple initializations, or manual ones for that matter, you need to check the documentation for that. Basically your configuration is not complete, as full configuration is;

// pluck values from your `GoogleService-Info.plist` you created on the firebase console
const iosConfig = {
  clientId: 'x',
  appId: 'x',
  apiKey: 'x',
  databaseURL: 'x',
  storageBucket: 'x',
  messagingSenderId: 'x',
  projectId: 'x',

  // enable persistence by adding the below flag
  persistence: true,
};

// pluck values from your `google-services.json` file you created on the firebase console
const androidConfig = {
  clientId: 'x',
  appId: 'x',
  apiKey: 'x',
  databaseURL: 'x',
  storageBucket: 'x',
  messagingSenderId: 'x',
  projectId: 'x',

  // enable persistence by adding the below flag
  persistence: true,
};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.