App reviews, troubleshooting, and recommendations
Hi everyone, i just making a public app but a get some problems with the webhooks. I create a webhook register in the app authentication and everything is ok, but after any server restart i lost my webhooks installation. So my question is, how may i keep a webhook registered in my app after a server restart. i've been using the new @Shopify/shopify-api package, and the way i've been registering webhooks is like this tutorial "https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/listen-for-store-events-with-w.... I hope you can help me in order to finish my app.
Regards
Solved! Go to the solution
This is an accepted solution.
Hi friend, all you need to do is re-register the webhooks handlers when your server restarts, like this:
Shopify.Webhooks.Registry.webhookRegistry.push({path: "/webhooks", topic: "ORDERS_PAID", webhookHandler: ordersPaidHandler});
Its discussed widely here, you can skip to the answer in this part of the discussion.
It's also mentioned in the documentation in the "Note" part, although it's not very informative and without an example.
Hopes this helps!
This is an accepted solution.
Hi @nir2002, thank you so much for this extremely usefull answer, i'm going to implement this snippets and see if it works, again thank you so much
Regards
Anjrot
After some days trying to understand how the connection to webhooks with the package @Shopify/shopify-api, i just returned to the old fashion way with the @Shopify/koa-shopify-webhooks, the problem is that after register a new webhook with the new implementation the webhookHandler inside the Shopify.webhooks.Registry.register do not work after a server restart. With the Koa-shopify-webhooks i can use the middleware receiveWebhook, it allows me to trigger the webhook no matter what i had restarted the server.
Let me know how to do this with the shopify-api package, i like to always use your new things
regards
Anjrot
This is an accepted solution.
Hi friend, all you need to do is re-register the webhooks handlers when your server restarts, like this:
Shopify.Webhooks.Registry.webhookRegistry.push({path: "/webhooks", topic: "ORDERS_PAID", webhookHandler: ordersPaidHandler});
Its discussed widely here, you can skip to the answer in this part of the discussion.
It's also mentioned in the documentation in the "Note" part, although it's not very informative and without an example.
Hopes this helps!
This is an accepted solution.
Hi @nir2002, thank you so much for this extremely usefull answer, i'm going to implement this snippets and see if it works, again thank you so much
Regards
Anjrot
its Worked for me, thanks
I can't thank you enough for this. Thank you so much. This fixed an issue I had for months in my app.
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024