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

138
Visualizações
Having error attempting to use RTDB in Expo managed

I'm attempting to use firebase realtime database on my app. I first authenticate and then I need to use the RTDB. Here is my attempt.

import { initializeApp } from 'firebase/app';
import 'firebase/auth';
import 'firebase/storage';
import { getDatabase } from "firebase/database";

import getEnvVars from '../environment';
const ENV = getEnvVars();

const firebaseConfig = {
  apiKey: ENV.firebase.API_KEY,
  authDomain: ENV.firebase.AUTH_DOMAIN,
  databaseURL: ENV.firebase.DATABASE_URL,
  projectId: ENV.firebase.PROJECT_ID,
  storageBucket: ENV.firebase.STORAGE_BUCKET,
  messagingSenderId: ENV.firebase.MESSAGING_SENDER_ID,
  appId: ENV.firebase.APP_ID
};



initializeApp(firebaseConfig);

export const db = getDatabase();

The error I get is:

TypeError: (0, _database.getDatabase) is not a function. (In '(0, _database.getDatabase)()', '(0, _database.getDatabase)' is undefined)
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You're mixing up the old, namespaced syntax of SDK versions 8 and lower, with the new, modular syntax of SDK versions 9 and above.

To get the database in v9, you call getDatabase() as a top-level function:

export const db = getDatabase();

I recommend keeping the Firebase documentation ready when going through this, as it has code samples for both the old and new syntax so you can easily compare. For this specific call, see the documentation on getting a database reference.

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