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

262
Views
Firebase 9 - Trying to create a user document once a user successfully signs up

I can't get a document created once a user signs up. This is Firebase 9 so I'm not sure what is missing. The user gets created no problem.

SignupPage.tsx

  const handleSignup = async (values: SignupFields) => {
    const { email, password } = values;
    try {
      const userAuth = await createUserWithEmailAndPassword(
        auth,
        email,
        password
      );

      const newUserObject: FirebaseUserObject = {
        uid: userAuth.user.uid,
        username: '',
        email: email,
        emailVerified: false,
        photoUrl: '',
        joinDate: new Date().toString(),
      };

      createNewUserDocument(newUserObject);
    } catch (error: unknown) {
      if (error instanceof Error) setErrorState(error.message);
    }
  };

firebaseFunctions:

export const createNewUserDocument = async (user: FirebaseUserObject) => {
  await setDoc(doc(db, 'users', user.uid), user);
};

Firestore Rules:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if true;
    }
  }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

may be you can add await to createNewUserDocument(newUserObject);

about 4 years ago · Juan Pablo Isaza Report
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!