Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
i got this email from shopify:
Your webhook for products/create at https://app.com/webhooks/orders/create is failing to return a successful response.
This webhook has been attempted 2 times. If your webhook continues to fail, it will be removed and your application will not receive any more notifications.
Im getting this message because Shopify is telling me they are not getting a 200 successful response after receiving the webhook
this is what my webhook looks like:
router.post('/webhooks/orders/create', webhook, (ctx) => {
ctx.status = 200
ctx.body = {
status: 'success',
message: 'Successfully updated.'
};
console.log('received order webhook: ', ctx.state.webhook);
])
ctx.status = 200
and
ctx.body = {
status: 'success',
message: 'Successfully updated.'
};
Solved! Go to the solution
This is an accepted solution.
Hi yanteb,
I am not familiar with Koa as well but maybe you should set the status as follows:
ctx.response.status = 200 as mentioned here => https://github.com/koajs/koa/blob/master/docs/api/response.md
Hey Hey,
I've had trouble in the past with webhooks as shopify wants a response within 5 seconds or it errors.
I had to return the response immediately, then do the processing later.
Your code below should return instantly, but is there more it's doing in the background?
I'm not that good with Koa,
but another troubleshooting step would be to call your API endpoint with Postman or another program, to see what's happening.
I would usually mimic the call Shopify is making and see what's happening.
This is an accepted solution.
Hi yanteb,
I am not familiar with Koa as well but maybe you should set the status as follows:
ctx.response.status = 200 as mentioned here => https://github.com/koajs/koa/blob/master/docs/api/response.md