Skip to content

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
    .onCreate((snapshot, context) => {
        const businessmenId = context.params.businessmenId;
        const buyId = context.params.buyId;
        const buy =;'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')
            if (querySnapshot.empty) {
                console.log('No matching documents.');
            querySnapshot.forEach((doc) => {
                console.log(, ' => ',;

But while compiling i am being thrown the below error

> C:UsersSumanKamakshiGaneshBurrabazarCloudfunctionsfunctionsindex.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.


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.