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

296
Views
Uncaught SyntaxError: Unexpected reserved word (await)

guys. I'm using Google Firestore to save some data in a database. If, for example, I use the code provided by Google to replace or create a new document in the database, I get the error: Uncaught SyntaxError: Unexpected reserved word. I know the problem is that await can only be used with asynchronous functions, but these are not functions created by me. They are imported from the Firestore libraries and I'm using the code provided by Google. What is wrong here? Thank you.

import { doc, setDoc } from "firebase/firestore";

await setDoc(doc(db, "cities", "LA"), {
  name: "Los Angeles",
  state: "CA",
  country: "USA"
})
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The "await" only makes the rest of the code wait for the method to finish.
If you want to keep it:

import { doc, setDoc } from "firebase/firestore";

(async function() {
  await setDoc(doc(db, "cities", "LA"), {
    name: "Los Angeles",
    state: "CA",
    country: "USA"
  })
})();

If not:

import { doc, setDoc } from "firebase/firestore";

setDoc(doc(db, "cities", "LA"), {
  name: "Los Angeles",
  state: "CA",
  country: "USA"
});
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!