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

389
Vistas
Firebase setDoc() not creating document

I'm creating a new user with auth which is working then taking that newly create uid to create a new document with the same.

const currentUser = await auth.createUserWithEmailAndPassword(email, pass);
        console.log('user registered')
        await setDoc(doc(db, "users", currentUser.user.uid),{
            forname: "Peter",
            surname: "Parker"
        })
        console.log('user profile added')
    dispatch({type:'USER_REG', payload: currentUser});

The reg process fires off without issue as I get the console log then the program just waits, its like setDoc is running but never completing and I have no idea why. Any help is appreciated.

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

0

Try:

import { getAuth, signInWithEmailAndPassword } from "firebase/auth";

const auth = getAuth();
await auth.createUserWithEmailAndPassword(auth, email, pass).then(async(userRec)=>{
    const user = userRec.user;
    await await setDoc(doc(db, "users", user.uid),{
        forname: "Peter",
        surname: "Parker"
    }).catch((error)=>{
        console.log(error);
    });
}).catch((error)=>{
    console.log(error);
});
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