# queryLoyaltyCoupons sample code shows error

**URL:** <https://forum.wixstudio.com/t/queryloyaltycoupons-sample-code-shows-error/71913>\
**Category:** Ask the community\
**Tags:** wix-loyalty-v2, wix-auth, wix-web-module, code, question\
**Created:** [July 4, 2025, 12:26pm UTC](https://forum.wixstudio.com/t/queryloyaltycoupons-sample-code-shows-error/71913 "2025-07-04T12:26:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Baksheesh](https://avatars.discourse-cdn.com/v4/letter/b/71c47a/32.png) [@Baksheesh](https://forum.wixstudio.com/u/Baksheesh)\
**Post date:** [July 4, 2025, 12:26pm UTC](https://forum.wixstudio.com/t/queryloyaltycoupons-sample-code-shows-error/71913/1 "2025-07-04T12:26:33Z")

</div>

I am trying to find a specific loyalty coupon by its user-inputted confirmation code. I’ve made some minor modifications here, but even the unedited sample backend code from the Wix documentation shows the same error and will not run.

```javascript
import { coupons } from "wix-loyalty.v2";
import { webMethod, Permissions } from "wix-web-module";
import { elevate } from "wix-auth";

const elevatedQueryLoyaltyCoupons = elevate(coupons.queryLoyaltyCoupons);

export const queryLoyaltyCouponByCode = webMethod(
  Permissions.Anyone,
  async (confirmationCode) => {
    try {
      // Build the query to filter by coupon reference code
      const query = {
        fieldsets: [],
        fields: [],
        sort: [],
        filter: {
          "couponReference.code": {
            "$eq": confirmationCode
          }
        }
      };

      const result = await elevatedQueryLoyaltyCoupons(query); //ERROR APPEARS HERE
      return result;
    } catch (error) {
      console.error('Error querying loyalty coupon:', error);
      throw error;
    }
  }
);

```

The API documentation including sample code can be found [here](https://dev.wix.com/docs/velo/apis/wix-loyalty-v2/coupons/get-loyalty-coupon).

The code will not run. There’s a red squiggly error marker under the word query with the message: " **‘await’ has no effect on the type of this expression. Expected 0 arguments, but got 1.**"

Seems odd that even the Wix sample code has this error.

(Loyalty app installed and have had no problems with other API functions.)
