Solved

Webhook: product_listings_update and _remove are always delayed

ralphYeo
Tourist
12 0 0

Hello, community

 

I've been building a Sales Channel App for a client.

 

I've installed webhooks and I found that when the app listens to the product_listing_add webhook, the webhook fires instantly however, the product_listing_update and the product_listing_remove always have some delay (5 - 15 seconds). So, if I remove a product and add a product from my sales channel hurriedly, I get the opposite result, which causes a hanging webhook call that runs forever in my app. 

The code is not different from product_listing_add and product_listing_update other than POST and PUT method. Any reason why this is happening?

Accepted Solution (1)
Busfox
Shopify Staff (Retired)
628 49 110

This is an accepted solution.

I see what you mean. The product_listing/remove webhook topic employs de-duplication when it shouldn't. Only update endpoints should do this.

 

I'm going to bring this up with our developer team and see if we can come up with a fix. Thanks for reporting the issue!

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 10 (10)

Busfox
Shopify Staff (Retired)
628 49 110

Hi @ralphYeo,

 

If you haven't already, I'd recommend reading the section about duplicate webhooks in this doc. The TLDR is that we employ a method of de-duplication for update webhooks so that you only get the latest state of an object 10 seconds after the initial update was performed. 

 

Let me know if you have any follow-up questions about this, or you believe you are experiencing a different issue altogether.

To learn more visit the Shopify Help Center or the Community Blog.

ralphYeo
Tourist
12 0 0

Thanks for the reply @Busfox.

 

I now understand there is a mechanism which causing this delay. However, if I understand correctly, there can be a problem in this system.

 

Here's my situation.

 

I see that remove an product_listing also have a 10 second delay because of the de-duplication mechanism. So, if I remove the product_listing and then add the product_listing in rapid succession, I lose the product_listing since product_listing creation webhook is called first( b/c this has no delay) and then removing the product_listing webhook is called after 10 seconds.

 

I don't think it's good idea to alert the merchants not to add the product_listing right after you remove the product_listing. Must I build some mechanism to prevent this to happen?

 

 

Busfox
Shopify Staff (Retired)
628 49 110

This is an accepted solution.

I see what you mean. The product_listing/remove webhook topic employs de-duplication when it shouldn't. Only update endpoints should do this.

 

I'm going to bring this up with our developer team and see if we can come up with a fix. Thanks for reporting the issue!

To learn more visit the Shopify Help Center or the Community Blog.

ralphYeo
Tourist
12 0 0

Thank you, @Busfox 

Would you mind sharing me when this could be happening? If it can be resolve within next two months, we don't need to worry about this before the app launch. 

Busfox
Shopify Staff (Retired)
628 49 110

I can't guarantee a timeline for a fix to this, as there are some issues with the approach I had in mind. If we remove the de-duplication from the remove webhook, then it's possible for update webhooks to be received after a remove webhook. We're looking at it holistically, but the reality is that it's a somewhat low priority issue.

 

In the meantime, I'd recommend adding polling to the mix to ensure the state of a product listing.

To learn more visit the Shopify Help Center or the Community Blog.

ralphYeo
Tourist
12 0 0

@Busfox There is another problem also regarding de-duplication and data flooding prevention problem.

 

When a merchant do bulk unpublish on the products from our custom sales channel(more than 5), few calls have data and rest of calls have empty data from Shopify which are delayed due to flooding prevention mechanism.

 

I'm okay with de-duplication and data flooding prevention with product_listings update webhook, however, these mechanism should be remove from product_listings remove webhook. Could you please escalate this matter?

 

Thanks,

 

Ralph,

Plus K

 

 

Busfox
Shopify Staff (Retired)
628 49 110

Hi @ralphYeo,

 

Product_listing/remove and product_listing/add webhooks don't have a request body. If you get one, it signifies the product has been unpublished or published from the sales channel. Only product_listing/update webhooks would have a body associated with it. Can you elaborate on what you believe the issue is?

To learn more visit the Shopify Help Center or the Community Blog.

ralphYeo
Tourist
12 0 0

@Busfox Let's say I'm unpublishing 50 items on my sales channel by bulk action.

 

I see that few items have {"product_id":1723053441088} before they hit data flooding prevention.

However, most items have {"product_id":null} after they hit data flooding prevention.

 

 I hope you run tests on this and see if you can provide some resolution.

 

Thanks,

 

Ralph,

Plus K

ralphYeo
Tourist
12 0 0

Any update on this?

Busfox
Shopify Staff (Retired)
628 49 110

Hi again @ralphYeo,

 

No updates for you yet, other than it being on our webhooks team's backlog. I'm still tracking any progress updates on the issue I created and will update here as soon as I have one for you.

 

To learn more visit the Shopify Help Center or the Community Blog.