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

795
Vistas
Cannot use "undefined" as a Firestore value. If you want to ignore undefined values, enable `ignoreUndefinedProperties`

Im getting this error

error is here: Error: Value for argument "value" is not a valid query constraint. Cannot use "undefined" as a Firestore value. If you want to ignore undefined values, enable `ignoreUndefinedProperties`. 

in my firebase javascript function and I have no idea how to solve it . I found out that in typescript this error happens . But what does this error means in javascript ?

This is my function

import * as functions from "firebase-functions";
import admin from "firebase-admin";

import {
  deleteCollection,
  deleteQuery,
  deleteUserData,
} from "../utils/deletion";
export default functions.firestore
  .document("deletions/{userUid}")
  .onDelete(async (snap, context) => {
    const db = admin.firestore();
    const { userUid } = context.params;
    const { uid } = userUid;
//dont forget to delete storage files
    try {
      await db.doc(`deletions/${userUid}/meinprofilsettings/${uid}`).delete();

        await deleteQuery(db, db.collection(`deletions/${userUid}/videos`).where("uid", "==", uid));

The line is the await deleteQuery...

The deleteQuery functions looks like this

async function deleteQuery(db, query, batchSize = 100) {
  const q = query.limit(batchSize);
  return new Promise((resolve, reject) => {
    deleteQueryBatch(db, q, resolve).catch(reject);
  });
}
async function deleteQueryBatch(db, query, resolve) {
  const snapshot = await query.get();
  const batchSize = snapshot.size;
  if (batchSize === 0) {
    // When there are no documents left, we are done
    resolve();
    return;
  }
  // Delete documents in a batch
  const batch = db.batch();
  snapshot.docs.forEach((doc) => {
    batch.delete(doc.ref);
  });
  await batch.commit();
  // Recurse on the next process tick, to avoid
  // exploding the stack.
  process.nextTick(() => {
    deleteQueryBatch(db, query, resolve);
  });
}

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

0

Error: Value for argument "value" is not a valid query constraint. Cannot use "undefined" as a Firestore value. If you want to ignore undefined values, enable ignoreUndefinedProperties.

This means that you have an ‘undefined’ value in your list. Firebase does not support undefined values in your list, check your list and see if something is undefined. You can avoid this by using ignoreUndefinedProperties. Here is an example of how you can achieve this:

import * as firestore from "firebase-admin";

Then just need to have something like this:

const db = firestore.firestore(); 
db.settings({ ignoreUndefinedProperties: true })
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