Webhook failing despite 200 response

downtownOTT
New Member
9 0 0

Hi,

I'm relatively new to development, I'm building a rails app as my first Shopify app. 

I've currently got a webhook on the orders_fulfilled event. The webhook and job behave as expected, but after the first successful event it keeps trying (and I get the emails saying it is failing). 

my shopify_app.rb:

config.webhooks = [
    {topic: 'carts/update', address: 'https://super-simple.ngrok.io/webhooks/carts_update', format: 'json'},
      { topic: 'orders/fulfilled', address: 'https://super-simple.ngrok.io/webhooks/orders_fulfilled', format: 'json'}
  ]

 

Then I've got a job (I've left out the code for brevity): 

class OrdersFulfilledJob < ActiveJob::Base
 

 

To test the job, I've made a button that creates and fulfills the order in a single click (it POSTS to orders#create in orders_contoller.rb, where I've written the logic)

You can see from this Ngrok screenshot that after I press that button it creates the order, successfully triggers the webhook with a 200, then continues to try again. 

Screen Shot 2020-09-10 at 11.23.44 AM.pngIn my server logs each subsequent POST request ends with "Filter chain halted as :verify_request rendered or redirected"

 

 

 

 

The docs say "Your webhook acknowledges that it received data by sending a 200 OK response" so I thought the 200 I'm seeing would do it, but obviously I'm missing something. 

Any help on how to stop the re-tries would be greatly appreciated!

 

0 Likes
olivert
Explorer
51 11 14

Hi mate,

Yep weird one for sure

Shopify has a 5 second time-out.

Perhaps your app isn't responding within the Window?

Maybe try calling your app with postman etc to see the response time.

This way you can guarantee your receiving a 200 response on the other end, and check the response time.

If your app is doing some processing before sending the 200 it will cause it to miss the 5 second window.

Or maybe there is a lot of latency between shopify servers and your endpoint. 

 

docs Under Frequency:

https://shopify.dev/tutorials/manage-webhooks#:~:text=Shopify%20has%20implemented%20a%20five,over%20....

0 Likes
downtownOTT
New Member
9 0 0

Thanks - it seems to be back up and working fine today - maybe it just need the good old 'turn the webhook off and turn it on again". I'll update this post if there are any more developments.

0 Likes