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

255
Views
How to properly update user information in firebase?

I have a code that is a form, basically is suppose to update the user information. According to Firebase documentation manage user but for some reason I'm getting this errors

enter image description here

This is what I have I don't think I'm missing anything is pretty much the same The only difference is that on my firebase.js I made new cons to make codes shorter but that shouldn't affect at all.

firebase.js

const db = firebase.firestore();
const auth = firebase.auth();
const storage = firebase.storage();

export {db, auth, storage};

Code

import {auth} from "./firebase"

const authUser = auth.currentUser
    const update = (e) => {
        e.preventDefault();
        authUser.updateProfile({
                displayName: {fullName}
        })
    }

I just wanted to test it on the user name first and then do all the others but I don't understand why is not working is super simple.

Update

enter image description here

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

0

authUser is undefined. This means that auth.currentUser was undefined at the time when it was assigned to authUser. This probably means that the user is not logged in. You will need to handle the case when the user is not logged in, like

import {auth} from "./firebase"

const authUser = auth.currentUser
    const update = (e) => {
        e.preventDefault();
        
        if (authUser) {
            authUser.updateProfile({
                displayName: fullName
            })
        } else {
            //User is not logged in, handle that case here
        }
    }
about 4 years ago · Juan Pablo Isaza Report

0

import {auth} from "./firebase";
const authUser = auth.currentUser;
const update = (e) => {
    e.preventDefault();
    authUser?.updateProfile({
        displayName: fullName
    });
}
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!