From b285b340e50aab61f0fdb8ad04258ef12010ad6b Mon Sep 17 00:00:00 2001 From: Rana Faraz Date: Wed, 27 Nov 2024 17:13:52 +0500 Subject: [PATCH] fix(common): updated docs added await to db query causing the value to be promise and causing server crash Issue#2868 --- docs/docs/guides/developer-guide/plugins/index.mdx | 2 +- .../example-plugins/wishlist-plugin/service/wishlist.service.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/guides/developer-guide/plugins/index.mdx b/docs/docs/guides/developer-guide/plugins/index.mdx index 4c13ffa346..7a3db57dba 100644 --- a/docs/docs/guides/developer-guide/plugins/index.mdx +++ b/docs/docs/guides/developer-guide/plugins/index.mdx @@ -358,7 +358,7 @@ export class WishlistService { */ async addItem(ctx: RequestContext, variantId: ID): Promise { const customer = await this.getCustomerWithWishlistItems(ctx); - const variant = this.productVariantService.findOne(ctx, variantId); + const variant = await this.productVariantService.findOne(ctx, variantId); if (!variant) { throw new UserInputError(`No ProductVariant with the id ${variantId} could be found`); } diff --git a/packages/dev-server/example-plugins/wishlist-plugin/service/wishlist.service.ts b/packages/dev-server/example-plugins/wishlist-plugin/service/wishlist.service.ts index 5bf9abf5e2..3b59d70022 100644 --- a/packages/dev-server/example-plugins/wishlist-plugin/service/wishlist.service.ts +++ b/packages/dev-server/example-plugins/wishlist-plugin/service/wishlist.service.ts @@ -33,7 +33,7 @@ export class WishlistService { */ async addItem(ctx: RequestContext, variantId: ID): Promise { const customer = await this.getCustomerWithWishlistItems(ctx); - const variant = this.productVariantService.findOne(ctx, variantId); + const variant = await this.productVariantService.findOne(ctx, variantId); if (!variant) { throw new UserInputError(`No ProductVariant with the id ${variantId} could be found`); }