Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

463
Views
¿Por qué tengo un error "default.initializeApp(...).auth is not a function" usando firebase?

Así que estoy creando una aplicación de reacción usando firebase y mi archivo firebase.js se ve así:

 import firebase from 'firebase/compat/app'; import "firebase/auth"; export const auth = firebase.initializeApp({ apiKey: "{my_key}", authDomain: "{domain}", projectId: "{project_id}", storageBucket: "{storage}", messagingSenderId: "{sender_id}", appId: "{app_id}", measurementId: "{blablabla}" }).auth();

Y mi Login.jsx :

 import firebase from 'firebase/compat/app'; import { auth } from '../firebase'; <Button onClick={() => auth.signInWithRedirect(new firebase.auth.GoogleAuthProvider())}>

Quiero iniciar sesión a través de Google, como puede ver, así que importo auth desde firebase.js , pero cuando npm start , aparece el siguiente error en la consola:

TypeError no detectado: firebase_compat_app__WEBPACK_IMPORTED_MODULE_0__.default.initializeApp(...).auth no es una función

No estoy seguro de por qué dice que auth no es una función.

Editar: también traté de importar con require('firebase/auth') pero no ayudó.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!