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

196
Views
Unhandled Rejection (TypeError): Cannot read properties of undefined (reading 'onSnapshot') version 9

In my App.js

componentDidMount() {
this.authListerner = auth.onAuthStateChanged(async userAuth => {
 if (userAuth){
   const userRef = await handleUserProfile(userAuth);
    userRef.onSnapshot(snapshot => {
     this.setState({
       currentUser: {
         id: snapshot.id,
         ...snapshot.data(),
       }
     })
   })
 }
  
 this.setState({
   ...initialState
 });
});
}

My utilis.js

export const handleUserProfile = async ({userAuth, additionalData = {}})
=> {
if (!userAuth) {
console.warn("No userAuth provided!");
return;
}
const { uid } = userAuth;
const userRef = doc(collection(firestore, `users/${uid}`));
const snapshot = await userRef.get();
if (!snapshot.exists) {
const { displayName, email } = userAuth;
const timestamp = new Date();
try {
  await userRef.setDoc(firestore, {
    displayName,
    email,
    createdDate: timestamp,
    ...additionalData,
  })
} catch(err) {
  console.warn(err);
}
}
return userRef;
};

the problem I facing

Can anyone help me with this. I cant get it to run. I am using firebase web version 9. which I trying to use a simple from version 8

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