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

384
Views
Firestore: Uncaught SyntaxError: Unexpected reserved word

I'm currently trying to upgrade my firebase code from version 8 to 9. However, I've encountered this error when I'm trying to get data from the database. It seems that await is causing the problem and I'm still pretty new in async.

function checkDatabaseData() {
    const uid = localStorage.getItem("uid");
    const docRef = doc(db, "userAdminCreds", uid);
    const docSnap = await getDoc(docRef);
    if (docSnap.exists()) {
      console.log("Document Data:", docSnap.data());
      return true;
    } else {
      console.log("No data");
      return false;
    }
  }

checkDatabaseData();

The HTML script tag

<script type="module" defer src="js/firebase-firestore-dashboard.js"></script>

This is just the same from the firebase guide: https://firebase.google.com/docs/firestore/query-data/get-data?authuser=0#web-version-9_1

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

0

To be able to use await word you need to have async word before function word.

async function checkDatabaseData() {
    // ...
    const docSnap = await getDoc(docRef);
    // ...
  }
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!