From 5353f4b7405e18ecc27725eda7ae3f1f2f1e2f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0smail=20Batuhan=20NARCI?= Date: Wed, 20 Mar 2024 17:04:04 +0300 Subject: [PATCH 1/4] Update multiple webhook handlers error --- packages/shopify-api/lib/webhooks/registry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shopify-api/lib/webhooks/registry.ts b/packages/shopify-api/lib/webhooks/registry.ts index c632ebcfb..b29ac4e07 100644 --- a/packages/shopify-api/lib/webhooks/registry.ts +++ b/packages/shopify-api/lib/webhooks/registry.ts @@ -116,7 +116,7 @@ function mergeOrAddHandler( break; } else { throw new InvalidDeliveryMethodError( - `Can only add multiple handlers when deliveryMethod is Http. Invalid handler: ${JSON.stringify( + `Can only add multiple handlers for a topic when deliveryMethod is Http. Please be sure that you used addHandler method for once after creating Shopify instance in your app. Invalid handler: ${JSON.stringify( handler, )}`, ); From f600d7c4d0f14c451595826d1aa187ed49dbd89a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0smail=20Batuhan=20NARCI?= Date: Wed, 20 Mar 2024 17:26:43 +0300 Subject: [PATCH 2/4] Update packages/shopify-api/lib/webhooks/registry.ts Co-authored-by: Liz Kenyon --- packages/shopify-api/lib/webhooks/registry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shopify-api/lib/webhooks/registry.ts b/packages/shopify-api/lib/webhooks/registry.ts index b29ac4e07..cd4609b54 100644 --- a/packages/shopify-api/lib/webhooks/registry.ts +++ b/packages/shopify-api/lib/webhooks/registry.ts @@ -116,7 +116,7 @@ function mergeOrAddHandler( break; } else { throw new InvalidDeliveryMethodError( - `Can only add multiple handlers for a topic when deliveryMethod is Http. Please be sure that you used addHandler method for once after creating Shopify instance in your app. Invalid handler: ${JSON.stringify( + `Can only add multiple handlers for a topic when deliveryMethod is Http. Please be sure that you used addHandler method once after creating ShopifyApi instance in your app. Invalid handler: ${JSON.stringify( handler, )}`, ); From 06a210bc48e2feb403f92e49e69c54738e0421de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0smail=20Batuhan=20NARCI?= Date: Wed, 20 Mar 2024 17:28:14 +0300 Subject: [PATCH 3/4] Add changeset --- .changeset/rich-falcons-clean.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changeset/rich-falcons-clean.md diff --git a/.changeset/rich-falcons-clean.md b/.changeset/rich-falcons-clean.md new file mode 100644 index 000000000..a845151cc --- /dev/null +++ b/.changeset/rich-falcons-clean.md @@ -0,0 +1,2 @@ +--- +--- From 5b36cf3e71af568e46059522207d6094e54a7bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0smail=20Batuhan=20NARCI?= Date: Thu, 21 Mar 2024 05:42:12 +0300 Subject: [PATCH 4/4] Update tests to pass CI/CD checks --- .../shopify-api/lib/webhooks/__tests__/registry.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/shopify-api/lib/webhooks/__tests__/registry.test.ts b/packages/shopify-api/lib/webhooks/__tests__/registry.test.ts index c0e37df42..41a98d0ab 100644 --- a/packages/shopify-api/lib/webhooks/__tests__/registry.test.ts +++ b/packages/shopify-api/lib/webhooks/__tests__/registry.test.ts @@ -69,7 +69,9 @@ describe('shopify.webhooks.addHandlers', () => { return shopify.webhooks.addHandlers({ PRODUCTS_CREATE: [EVENT_BRIDGE_HANDLER, EVENT_BRIDGE_HANDLER], }); - }).toThrow('Can only add multiple handlers when deliveryMethod is Http.'); + }).toThrow( + 'Can only add multiple handlers for a topic when deliveryMethod is Http. Please be sure that you used addHandler method once after creating ShopifyApi instance in your app.', + ); }); it('fails if pubsub handlers point to the same location', async () => { @@ -79,7 +81,9 @@ describe('shopify.webhooks.addHandlers', () => { return shopify.webhooks.addHandlers({ PRODUCTS_CREATE: [PUB_SUB_HANDLER, PUB_SUB_HANDLER], }); - }).toThrow('Can only add multiple handlers when deliveryMethod is Http.'); + }).toThrow( + 'Can only add multiple handlers for a topic when deliveryMethod is Http. Please be sure that you used addHandler method once after creating ShopifyApi instance in your app.', + ); }); it('adds handler with lowercase/slash-period format to the webhook registry', async () => {