Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Update multiple webhook handlers error #1290

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/rich-falcons-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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 () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/shopify-api/lib/webhooks/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 once after creating ShopifyApi instance in your app. Invalid handler: ${JSON.stringify(
handler,
)}`,
);
Expand Down
Loading