FROM CACHE - en_header

Hourly Fetch_Stock no longer working

AshleyMalvankar
New Member
11 0 0

We have a private app that updates inventory for various Shopify stores via the hourly fetch_stock callback. This has worked correctly for over a year but in the last week or so, the inventory has stopped being updated (it has stopped on both existing Shopify stores and brand new Shopify stores that have our private app).

I believe it is calling https://ourapp.com/api/fetch_stock.json

In one newly associated store, where it currently has all 0s for inventory (for items fulfilled by us), I manually switched one product from being fulfilled by us to be manual and then switched it back (to trigger the fetch_stock) and it did update with a number but believe we got a 404 on the backend. 

Example shop id is 462006419102

Any help is appreciated!!

 

 

 

 

Replies 10 (10)
AshleyMalvankar
New Member
11 0 0

@_JB or Shopify Staff - any insight into fetch_stock and why it is no longer working?

_JB
Shopify Staff
Shopify Staff
836 99 211

Hi @AshleyMalvankar,

I haven't been able to replicate any issues with fetch_stock on my end this morning, but I'm happy to take a look at your shop. The shop_id you provided appears to be invalid, can you double check that and provide the shop id again?

 

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

AshleyMalvankar
New Member
11 0 0

Hi @_JB ,

 

Thanks for the reply. I had a little difficulty finding the Shopify ID for some of the stores I am working with. Here is one of the their links (where there is no inventory coming in automated): 

https://talis-us.myshopify.com/

_JB
Shopify Staff
Shopify Staff
836 99 211

Hey @AshleyMalvankar,

I just checked our logs for the fetch_stock URL you provided, and I can confirm the calls are happening once an hour as expected. Your server seems to be responding, but in all cases the response is empty.

I recommend installing the app on a test store with 1 product, and check your app's logging to ensure the proper response is being sent. Since your server is responding but the response is empty, I'd start by looking at whatever logic you have setup that routes requests to the desired shop's inventory. 

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

AshleyMalvankar
New Member
11 0 0

Thanks - I will definitely check that out. If I update a product to have a different fulfillment and then change back to being fulfilled by my app, it will update the inventory correctly. Would there be a difference in the way the fetch_stock or my response is whether it is for a manual request or an automatic hourly request?

_JB
Shopify Staff
Shopify Staff
836 99 211

Hey @AshleyMalvankar,

Yes, when you update a single product, Shopify's fetch_stock request will include the SKU as a URL parameter. So in that case we're only asking for inventory on that individual SKU. The hourly request wants every SKU in the response, so it doesn't contain the URL parameter.

If your app is responding correctly to the individual requests, it sounds like you just need to ensure the app responds with all SKUs for a given store if the SKU param isn't present in the request.

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

nsmith0333
Tourist
6 0 1

@_JB Are there any limitations to the fetch_stock API request in the situation above? Is it possible to reduce the hourly call for all SKU's down to every 15 minutes or less?

nsmith0333
Tourist
6 0 1

@_JB Can the fetch stock API ping an inventory table multiple times an hour? We would like it to retrieve all SKU's to have more accurate inventory. Does the fetch_stock API follow the leaky bucket algorithm? 

_JB
Shopify Staff
Shopify Staff
836 99 211

@nsmith0333 The fetch_stock call happens once per hour, there's no way to change the frequency. When the hourly call happens it asks for all SKUs. This means if you're using the fetch_stock endpoint, your inventory will be synced with Shopify once per hour.

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

nsmith0333
Tourist
6 0 1

@_JB To be clear, this means the fetch_stock API does not fall in the leaky bucket limits. Is that correct?