Your webhook is failing although 99% work

Your webhook is failing although 99% work

Shopify Partner
3 0 1

I am successfully running a Shopify app with webhooks and 99% of them succeed, but sometimes I get an Email from Shopify that my webhook is failing. This is only for a single client of ours and only every other week for a single time:

Your webhook for orders/fulfilled at https://*******/api/webhook/shopify is failing to return a successful response.
This webhook has been attempted 10 times. If your webhook continues to fail, it will be removed and your application will not receive any more notifications.



If I check my logs I also sometimes receive a message like this:

Failed to process webhook: Error: Could not validate request for topic orders/create





I habe absolutely no clue why this is happening and how to fix this? Has anybody experienced this issue as well? So basically everything is working fine, but this error happens sometimes and I am scared of losing the webhook subscription at any time due to this incident.


I am using nodeJS as the backend which handles all the webhooks like mentioned in the SDK description. This is how it looks in my code:




exports.validateShopifyWebhook = async (req, res) => {
    try {
        await Shopify.Shopify.Webhooks.Registry.process(req, res);
        console.log(`Webhook processed, returned status code 200`);
    } catch (error) {
        console.log(`Failed to process webhook: ${error}`);
        console.log([req, res]);
        if (!res.headersSent) {





Thanks for any help!

Reply 1 (1)

Shopify Partner
10 1 6

Take advantage of any webhook delivery service. I know this isn't the exact answer you're looking for but it might help if you have a service that simply only forwards webhooks to you in the event your own servers hang or go offline it should still be accepted and prevent Shopify from shutting your webhook down.

Most services should provide efficient logging and notifications so you won't be missing out on alerts.


Now to fix your code it'll be hard to tell without knowing what you're doing with the webhooks. If you are parsing it in anyway and using them it could likely be sometimes a customer doesn't fill all details or even fills more details and your program simply hangs because its either looking for something undefined or can't define something. 

Sometimes it can even be database issues so generally for production

Shopify > Webhook Delivery Service > Your webhook handlers

You can even handle your own webhook service to ensure it'll always reply to Shopify by simply storing it then sending it off to process