Webhook get called multiple times

Highlighted
New Member
3 0 0

Hi,

 

I have an app that uses API to create Webhook for order/paid event. I use Azure function as an end point to receive the webhook. This function adds the message to Service Bus Queue for later processing and returns OK 200.

The problem is, that the same webhook gets called multiple times even if it receives 200 response!

Because of this I get a lot of 429 rate limit exceptions in my Queue processing Azure function.

Why is the same webhook called multiple times when the response is 200?

0 Likes
Shopify Staff
Shopify Staff
672 14 78

Hey there, 

 

This typically occurs when we're either not actually receiving your 200OK responses, or they're not being sent fast enough. 

 

Would you be able to provide an example order ID that you received multiple webhooks for?

0 Likes
New Member
3 0 0

Hi,

 

response is fast enough, average around 200ms.

This is draftOrderId, that was send to webhook end point and got called 3 times,

draftOrderId: 233336176693

Azure Function response to webhook:

 

Webhook.png

List of 3 identical request to webhook end point with same draftOrderId. Response is 429 because processing of webhook exceeds rate limit, But data is added to Queue and processed by separate function.

 

Webhook1.png

 

My functions always returns 200
https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.okresult?view=aspnetcore-2.2 

 

Here you can see trace of calls for webhook. It is clear that function "OrderPaid" is executed with response before processing of Queue Worker starts

Webhook2.png

0 Likes
Shopify Staff
Shopify Staff
672 14 78

Hey again, 

 

The draft order ID that you linked to is a saved draft order, and hasn't been turned into an order and marked as paid yet - so it won't trigger an orders/paid webhook. Orders/paid webhooks will only fire when an order resource is paid for, or a draft order is marked as paid which turns it into an order.

 

I also noticed that you have 59 orders/paid webhooks registered on this shop with different URLs, which would cause several webhooks to be sent. This means that for every order marked as paid on your shop, there would be 59 webhooks being triggered.

 

In good news, there don't seem to be any errors on our end and we're successfully receiving 200OK responses, but normally you would only register a single orders/paid webhook and send them all to one URL that processes them. If you were to remove all of your webhook subscriptions from this shop and then add one of them back again, I think you'll notice that this stops happening.

0 Likes