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.
I faced a similar issue with firebase firestore's setDoc() function for me the problem was actually due to firestore rules being set too restrictively and not allowing to setdocs.
check the rules and adjust them:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With