🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Issue with API rate limit and connection error while querying the API in local development.

18 replies
Last updated: Sep 3, 2021
I got a single error while querying the API
API rate limit exceeded
. Since then, I’m getting
ECONNREFUSED 34.102.211.197:443
.
The project usage seems well within its limits, and I’m not getting the error if I change to another network connection.

Could it be that my IP has been blocked? Is there anyone here who can help me to figure this out?
Sep 1, 2021, 10:15 AM
It seems to be working again. I’m still curious to find out what it could have been, for next time.
Sep 1, 2021, 10:45 AM
can you please check that your API is getting called in a loop i faced same issue check in console.
Sep 1, 2021, 10:46 AM
Thanks User. There is quite a bit of outgoing requests, but no infinite loops, if that’s what you mean?
Sep 1, 2021, 11:01 AM
It worked for a while, but now I get the same error again. Hmm…
Sep 1, 2021, 11:01 AM
Now I’m getting
getaddrinfo ENOTFOUND [project_id_masked].<http://api.sanity.io|api.sanity.io>
Sep 1, 2021, 11:05 AM
And now it’s working again… Strange
Sep 1, 2021, 11:05 AM
can you send me the console pic.
Sep 1, 2021, 11:06 AM
Hey User! What's the context that you're getting this error in?
Sep 1, 2021, 6:39 PM
Hi
user M
. I’m getting these errors in local development while building – using a custom static site generator. There are about 600 queries, but I’m caching them to disk, so they are requested only once in a while whenever I manually empty the cache. Of course, then all of them will be requested in one burst.
Sep 2, 2021, 7:39 AM
Hi
user M
. I’m getting this in local development while building using a custom static site generator. There are about 600 queries, but I’m caching them to disk, so they are requested only once in a while whenever I manually empty the cache. Of course, then all of them will be requested in one burst.
Sep 2, 2021, 7:39 AM
Hi
user M
. I’m getting these errors in local development when building a website using a custom Node.js static site generator. It uses
@sanity/client
.
There are about 600 queries, but I’m caching the results to disk, so they are requested only once in a while whenever I manually empty the cache. But of course, then all of them will be requested in one burst.
Sep 2, 2021, 7:43 AM
I’m usually not using the CDN in development, relying on the local on-disk cache I put between.
Sep 2, 2021, 7:45 AM
I’m usually not using the CDN in development.
Sep 2, 2021, 7:45 AM
Ah, got it. I think you're hitting this rate limit for concurrent queries, which is why you're only occasionally getting the error.
Sep 2, 2021, 5:16 PM
That must be it
user M
. Thank you very much!
Sep 3, 2021, 6:11 AM
Does the
@sanity/client
have the option or possibility to rate limit itself?
Sep 3, 2021, 10:22 AM
Is there any way to limit concurrency in the
@sanity/client
?
Sep 3, 2021, 10:22 AM
There isn't a method built into the client, but there's an example of handling concurrency in this bit of the docs . You could probably adapt it to suit your needs here!
Sep 3, 2021, 5:45 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?