RATE_LIMIT_ERROR on UpsertCatalogObject calls

I haven’t seen anymore of the “ghost” errors that occurred and weren’t logged, but today I did get another seemingly random RATE_LIMIT_ERROR that was logged:

As you can see, there weren’t what I would consider “high rate” messages going on at the time. I’m still a little stumped about why I get these errors sometimes. It doesn’t seem like the recommended retry logic with exponential backoff would help much, because it doesn’t appear I’m actually exceeding any reasonable rate limits when this occurs, but I’m open to suggestions…

There’s not much more that you can do other than retry the call when you get a one off 429 like this. If you’re getting multiple errors in a row then the exponential backoff will need to kick in. :slightly_smiling_face:

Ok. Just for my own sanity, does it appear from your end that I’m actually exceeding a rate limit?

Are you monitoring the QPS’s for all your calls to the Catalog API? We really don’t have a tool to determine if you’re exceeding limits. All we can recommend is that you handle the 429 gracefully. :slightly_smiling_face:

In the seconds leading up to that 429, my app made no more than 2 queries per second to the Catalog API. Generally, my app never exceeds ~3 queries per second to any endpoint. I know you don’t publish rate limits, but it would be helpful to know if that’s even within the same scope for a rate that would reasonably trigger a RATE_LIMIT_ERROR.

You should be fine with 3 QPS. The best thing to do is handle the error gracefully. :slightly_smiling_face:

1 Like

Hi

The following error has occurred for upsertCatalogObject on Sandbox.

Could you support me for this.

Regards.

{ [“category”:“Square\Models\Error”:private]=> string(16) “RATE_LIMIT_ERROR” [“code”:“Square\Models\Error”:private]=> string(12) “RATE_LIMITED” [“detail”:“Square\Models\Error”:private]=> string(32) “Catalog locked by prior request.” [“field”:“Square\Models\Error”:private]=> NULL } }

Hi @onderboydak ,

Same suggestions as Bryan has given in this same post,

Square does have rate limits but we don’t document the limits. We encourage you to handle the limit gracefully by building a retry mechanism. This mechanism should have an exponential backoff schedule to reduce requests when volume is necessary. Also some randomness wouldn’t hurt to avoid a thundering herd effect.

Hi

Thank you for information. the same error is giving on production. We can not change our account. Could you support me for this?

Regards.

Hi @onderboydak,

We would expect developer’s applications to reach a point where they start running into rate limiting in production. The solution for running into the rate limit is our suggestion to exponentially backoff schedule your requests, with randomness to avoid thundering herd effect.

Alternatively, maybe we can talk about what your application is doing, and what API calls are starting to run into a rate limit. Maybe I can make some suggestions on optimizing your implementation of API calls to reduce the number of API calls you are making. Or maybe you should consider webhooks to get information about events as they happens, backed up by polling the APIs less often.

Hi

We are the institution that sells digital codes. I have been using your API for about a month. Espacially the catalog API. Before the error , I was working for the adjust stock quantity. The rate limit error is valid, but it should be canceled after a certain time for the developers. I would be very happy if you provide a quick solution. regards.

Hi

I have tried the another sandbox account but same error. I think Rate Limit is working as IP based.

How can we speed up the support process?

Thank you.