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

506
Vistas
setDoc() Called with invalid data. Unsupported field value: undefined

I'm trying to create a new firestore document when someone subscribes to my api plan. I want the document id to be the customer id, but i ran into this error.

While the setDoc documentation says that if the document can't be found it will be created with the providing document id. So here is my code:

import { db } from './resources/firebase.js';
import { doc, setDoc } from "firebase/firestore";

await setDoc(doc(db, "customers", customerId), {
                key: hashedApiKey,
                itemId: itemID,
                active: true,
                calls: 0
            });

and here is a screenshot of the firestore side: enter image description here The current entry is just a test value.

Can someone explain me what i'm doing wrong here?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Based on the error message, it is most probably because the value of one of the fields of the document to be saved is undefined, i.e. hashedApiKey or itemID. You should debug your code by printing the values of these two variables.

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