Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

176
Vistas
Next.js & Firebase -> TypeError: Cannot read properties of undefined (reading 'apps')

what I am trying to do, is to code an auth. with NextJS and Firebase.

Now the problem appears in my firebaseClient.js, where I get the error "TypeError: Cannot read properties of undefined (reading 'apps')".

The code looks like this:

import firebase from "firebase/app";

import "firebase/auth";
import "firebase/database";

const FIREBASE_CONFIG = {
  // config files from firebase here
};

export default function firebaseClient() {
  if (!firebase.apps.length) {
    firebase.initializeApp(FIREBASE_CONFIG);
  }
}

In the console I get this error: Terminal Error

This appears on the localhost:3000: Error Page on localhost:3000

I am following this YT tutorial here , which is from 2020, so some imports, as far as I can tell, changed.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

It seems your code has firebase v8 while you have firebase v9 package and it has completely different import structures. This happen lot when you follow some tutorials with v8 and install firebase so it get latest version on default that's v9

What should you do:

1- Remove current version

npm rm firebase

2- install latest of 8.x

npm install firebase@8.9

about 4 years ago · Juan Pablo Isaza Denunciar

0

I found a tutorial, and the video reproduces 100% of the errors you get with the outdated v8 firebase version. I followed the tutorial and it actually works, and when adapting the code to firebase v9, it runs again.
YouTube Video

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda