Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

789
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda