Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

301
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda