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

366
Views
Why does this piece of code produce following error: "user.updateUser is not a function"

I have created a general function for creating a new user with firebase. It looks like this:


export function createUserEmailPassword(email, password, username) {
  createUserWithEmailAndPassword(auth, email, password)
    .then((userCredential) => {
      const user = userCredential.user;
      user
        .updateProfile({
          displayName: username,
        })
        .then(() => {
          alert("Welcome " + user.displayName);
        });
    })
    .catch((error) => {
      const errorMessage = error.message;
      alert(errorMessage);
    });
}

For some reason, user.updatProfile produces the error: "user.updateProfile is not a function", which doesn't let me set the display name.

The goal of the function is to set the displayname to the username upon creating a new user.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The updateProfile() is a top-level function in new Firebase Modular SDK just like createUserWithEmailAndPassword(). Try refactoring the code as shown below:

import { updateProfile } from "firebase/auth"

createUserWithEmailAndPassword(auth, email, password)
  .then(async (userCredential) => {
    const user = userCredential.user;
    await updateProfile(user, {
      displayName: username,
    })
    alert("Welcome " + user.displayName);
  })
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!