Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

230
Visualizações
React Native firebase is undefined

Hi I keep getting this error when trying to run my react-native app on expo go on my phone

TypeError: undefined is not an object (evaluating '_app.default.apps') and the error shows it pointing to the firebase variable on line 19 in the code below in the if statement where it says firebase:


import firebase from 'firebase/app';
require('firebase/auth');
import Constants from 'expo-constants';


// Initialize Firebase
const firebaseConfig = {
  apiKey: Constants.manifest.extra.apiKey,
  authDomain: Constants.manifest.extra.authDomain,
  projectId: Constants.manifest.extra.projectId,
  storageBucket: Constants.manifest.extra.storageBucket,
  messagingSenderId: Constants.manifest.extra.messagingSenderId,
  appId: Constants.manifest.extra.appId,
  measurementId: Constants.manifest.extra.measurementId
};

let Firebase;

if (firebase.apps.length === 0) {
  Firebase = firebase.initializeApp(firebaseConfig);
}

export default Firebase;

this in turn is causing I believe an Invariant violation as well.

Any help please?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

FirebaseSDK changed their API in the new version 9 so now import firebase from “firebase/app” won’t work

You need to use the import { initializeApp } from 'firebase/app'; to initiate your app or import from firebase/compat/app to use the old API

Refer to https://firebase.google.com/docs/web/modular-upgrade for more about the changes and https://firebase.google.com/docs/web/setup for the new API

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda