Missing "throttleStatus" property

Kris_Doyle
Shopify Partner
87 0 19

Hi Shopify,

 

On November 15, 23, and 24, I noticed some new errors in the logs:

"Undefined property throttleStatus".

 

This is of course the throttle status property returned by the GraphQL API to facilitate rate limiting. I have never seen this before until now, and I suppose it's only intermittent, so I'm wondering, if it possible that the GraphQL API may not always return a throttle status?

 

The "cost" IS being returned with the other props for requestedQueryCost, and actualQueryCost, it's just throttleStatus that's not always returned it seems.

 

Thanks!

Kris

0 Likes
Kris_Doyle
Shopify Partner
87 0 19

Hi Folks,

 

Unfortunately I need to stress the urgency a little here. Since the "throttleStatus" is now randomly not available, my throttle logic is no longer working correctly and my API calls are starting to get throttled.

 

Does anyone know what might be happening here? 

0 Likes
Kris_Doyle
Shopify Partner
87 0 19

Anyone? Shopify? Help?

 

Is it normal that the throttleStatus attribute is just...missing?

 

I'm intermittently getting requested and actual query cost, but throttleStatus (with the useful stuff) is just undefined. I can't imagine this is normal.

0 Likes

@Kris_Doyle wrote:

Anyone? Shopify? Help?

 

Is it normal that the throttleStatus attribute is just...missing?

 

I'm intermittently getting requested and actual query cost, but throttleStatus (with the useful stuff) is just undefined. I can't imagine this is normal.


Hi @Kris_Doyle ,

 

We just hit the same error. I guess when the merchant is in staff plan, we don't get throttleStatus. You need to add an additional null check for throttleStatus.

 

I hope Shopify adds an exception to the graphql response section about it.

https://shopify.dev/concepts/about-apis/rate-limits

Co-Founder / Developer at: merchbees
Merchbees Low Stock Alert - Keep track of your low stock items by email and slack
Merchbees Inventory Value - Know your inventory value and quantity in real-time
Push Down & Hide Out of Stock - Move out of stock products to the bottom of the collection to improve SEO & hide/ unhide automatically
Kris_Doyle
Shopify Partner
87 0 19

Thanks very much @Mete ,

 

I threw a null check in there a while back so I guess that's how it will stay :)

 

I'm a little confused why they wouldn't include the throttleStatus for those plans. I understand that the staff aren't throttled, but the way I'd probably handle that is by just passing back whatever the max is all the time rather than just removing it so we don't need special checks...it just continues to work normally.

 

Also, it's probably best to still have a throttle in place in the case of bad actors who might take advantage of a staff plan to slam the API. Not likely I guess but security shouldn't be based on what will happen ;)

 

Agree 100% on adding it to the docs though but maybe they left it out on purpose (for the above reason)?

 

Cheers,

Kris

0 Likes
Kris_Doyle
Shopify Partner
87 0 19

Hey @Mete ,

 

Thanks again for the help with this. Unfortunately it seems I spoke too soon. Just last night I received another call with a missing throttleStatus. This time it was just a regular user with a Basic Shopify plan. The other throttle elements were there, just not the throttleStatus.

 

Seems this is still a mystery sadly.

 

Kris


@Kris_Doyle wrote:

Hey @Mete ,

 

Thanks again for the help with this. Unfortunately it seems I spoke too soon. Just last night I received another call with a missing throttleStatus. This time it was just a regular user with a Basic Shopify plan. The other throttle elements were there, just not the throttleStatus.

 

Seems this is still a mystery sadly.

 

Kris


Hey @Kris_Doyle ,

 

Thanks for the heads up! Our app was throwing errors because even the official nodejs library doesn't null check throttleStatus. We sent a fix to github yesterday.

 

I hope someone from staff explains whats going on and at least, puts this exception to the docs :)

Co-Founder / Developer at: merchbees
Merchbees Low Stock Alert - Keep track of your low stock items by email and slack
Merchbees Inventory Value - Know your inventory value and quantity in real-time
Push Down & Hide Out of Stock - Move out of stock products to the bottom of the collection to improve SEO & hide/ unhide automatically
Kris_Doyle
Shopify Partner
87 0 19

Hi All,

Anyone have any updates on this? Although I have a handler in place, it makes it difficult to calculate the throttle when there's no status being returned.

Can someone from Shopify just acknowledge that this is at least on the radar, and is or is not a known issue please?

Getting this a few times per day :(

0 Likes
Kris_Doyle
Shopify Partner
87 0 19

Just bumping because I'm still seeing it at least every second day. 

Thanks,
Kris

0 Likes
Kris_Doyle
Shopify Partner
87 0 19

Hi All,

Since this issue still exists (getting these errors several times per week now), we've decided to take advantage of a query cost calculator that we put together a while back (can't remember why though lol). This will take the place of the throttle status result coming back from the GraphQL API in cases where it's unavailable.

For anyone that wants to do the same thing, we're basically iterating over the fields we're asking for and assigning a cost value based on what we've received back from Shopify in the past. For any nested queries, we recursively apply a multiplier. This has been generally accurate to within +1 point (i.e. sometimes we calculate a cost of say, 101, but then we get back an actual cost of 100) - as long as you're erring on the high side, you should be fine in terms of throttling.

Hopefully the throttle status is fixed at some point, but in the meantime, manually calculating the cost is actually pretty easy and generally reasonably accurate.

Cheers