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

270
Vistas
Next.js, Firebase, Unhandled Runtime Error - TypeError: Cannot read property 'initializeApp' of undefined

I have no idea why this error happens... but I suspect this file causes something?? Especially, firebaseAuth={getAuth(app)} might be a problem. Before that, const app = initializeApp(firebaseConfig); is defined in "../firebase/firebase"

import React from "react";
import StyledFirebaseAuth from "react-firebaseui/StyledFirebaseAuth";
import { app } from "../firebase/firebase";
import { getAuth, createUserWithEmailAndPassword, EmailAuthProvider, GoogleAuthProvider, GithubAuthProvider } from "firebase/auth";

// Configure FirebaseUI.
const uiConfig = {
  signInFlow: 'popup',
  signInSuccessUrl: "/",
  signInOptions: [
    EmailAuthProvider.PROVIDER_ID,
    GoogleAuthProvider.PROVIDER_ID,
    GithubAuthProvider.PROVIDER_ID,
  ],
};

export default function SignInScreen() {
  return (
    <div>
      <h1>PolygonHR Login</h1>
      <p>Please sign-in:</p>
      <StyledFirebaseAuth uiConfig={uiConfig} firebaseAuth={getAuth(app)} />
    </div>
  );
}
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Finally, I found that this library called "react-firebaseui/StyledFirebaseAuth", which I use above, support firebase version 8.x.x instead of v9 above, so this is why this error message in title has been shown.

To fix this,

  1. downgrade and adjust firebase version that the library requires
  2. or switch the library with another one to display authentication button.
about 4 years ago · Juan Pablo Isaza Denunciar

0

With new version of Firebase the syntax to import is changed. Try with this: import { initializeApp } from 'firebase/app'; I suggest you to read this post to identify and fix other problem in your app. https://firebase.googleblog.com/2021/08/the-new-firebase-js-sdk-now-ga.html

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