-
Notifications
You must be signed in to change notification settings - Fork 390
v6: InvalidWebhookError: No HTTP webhooks registered for topic products/update #625
Comments
Hi again! This error is thrown when the library can't find the handler to call for a specific topic, as you mentioned. Just to make sure the set up is correct here, are you adding a handler for that topic, as per https://github.com/Shopify/shopify-api-js/blob/main/docs/migrating-to-v6.md#changes-to-webhook-functions? I assume your call looks like this? await shopify.webhooks.addHandlers({
PRODUCTS_UPDATE: {
deliveryMethod: DeliveryMethod.Http,
callbackUrl: shopify.config.webhooks.path,
callback: () => { /* ... */ },
},
});
That makes sense. |
Hi & thanks,
Yes, when the app starts, similar to your code example let handlers2 = {
PRODUCTS_UPDATE: {
deliveryMethod: 'http',
callbackUrl: `https://pastebin.com`,
callback: () => { console.log('test PRODUCTS_UPDATE') },
}
}
console.log('handlers2', handlers2)
await shopify.webhooks.addHandlers(handlers2)
const topicsAdded = shopify.webhooks.getTopicsAdded()
console.log('topicsAdded', topicsAdded) gives
Note that these webhooks are created with v5 and show properly when listed. |
Ok, it turns out that Having a shopify-api-js/lib/webhooks/process.ts Line 62 in 0d19fe2
|
Hmm, don't know how to solve this. I'm using Fastify, calling
Even if it would include a host a hostname, might not the same as I think URLs or even delivery methods shouldn't be compared. Just process the webhook, please , as in v5. |
That's a fair point - we shouldn't consider the hostname in the comparison, and instead just check the paths here. |
I've updated my comment:
Just comparing paths won't work either, as our development has a webhook processing service with a random path, which forwards to localhost/fixed/path. |
Thanks Paulo! Looking forward to next release :) |
Issue summary
Trying to migrate from v5 to v6. Updated code as per guide.
Webhooks are registered for topics such as
PRODUCTS_UPDATE
but
shopify.webhooks.process()
givesInvalidWebhookError: No HTTP webhooks registered for topic products/update
Looks like
products/update
got forgotten to be handled asPRODUCTS_UPDATE
internally?If we do the registration wrong, at least the error message should reference to correct topic.
Checklist
The text was updated successfully, but these errors were encountered: