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

307
Vistas
Getting `eslint' - parsing error, while compiling firebase cloud function

Recently I've started working on a project based on firebase cloud functions and firestore database. I'm writing a cloud function trigger function which will query a "Collection group", on a new document being created.

Below is the cloud function code file:

exports.findDealsOnBuy = functions.firestore
    .document('businessmen/{businessmenId}/buy/{buyId}')
    .onCreate((snapshot, context) => {
        const businessmenId = context.params.businessmenId;
        const buyId = context.params.buyId;
        const buy = snapshot.data();
        functions.logger.info('businessmenId : ', businessmenId, ' buyId : ', buyId, ' buy : ', buy );
        const sellGrpRef = admin.firestore().collectionGroup('sell');
        const querySnapshot = await sellGrpRef.whereEqualTo('goodsName', '==', buy.getGoodsName())
            .whereEqualTo('goodsLocation', '==', buy.getGoodsLocation())
            .whereEqualTo('status', '==', 1)
            .whereEqualTo('status', '==', 5)
            .whereLessThanOrEqualTo('bestPrice', '<=', buy.getBestPrice())
            .orderBy('bestPrice', 'desc')
            .get();
            
            if (querySnapshot.empty) {
                console.log('No matching documents.');
                return;
            } 
            
            querySnapshot.forEach((doc) => {
                console.log(doc.id, ' => ', doc.data());
            });
    });

But while compiling i am being thrown the below error

> C:\Users\Suman\Kamakshi\Ganesh\Burrabazar\Cloudfunctions\functions\index.js
> 31:31  error  Parsing error: Unexpected token sellGrpRef

I tried a lot but I am unable to find a clue how to resolve this. Requesting help to resolve.

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

0

I am sharing now that I found the await documentation in MDN Web Doc.

To wait for a Promise, use the await operator. Within standard JavaScript code, it can only be used inside an async function.

You can use await within a function if you use the async keyword before the function definition. When you wait for a promise to settle, the function is stopped in a non-blocking manner. You get the value back if the promise is kept. The rejected value is thrown if the promise fails.

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