API rate limit error followed by ECONNREFUSED - IP blocked?
I understand how frustrating this situation is! Based on your symptoms, it does appear that your IP address may have been temporarily blocked after triggering the rate limit. The fact that switching to another network connection resolves the issue is a strong indicator of an IP-level block.
The IP address 34.102.211.197:443 is one of Sanity's API servers, so the ECONNREFUSED error suggests your requests from that specific IP are being rejected at the connection level.
Why this happens: When Sanity's API detects rate limit violations, it can temporarily block the offending IP address as a protective measure. Even though your project usage is within limits, the rate limiting is often applied per IP address per time window, not just overall project usage.
Immediate solutions:
Wait it out: These blocks are typically temporary (often 15-60 minutes). If you can afford to wait, the block should lift automatically.
Use a different network: As you've discovered, switching networks (different IP) works. This could be switching between WiFi and mobile hotspot, or working from a different location temporarily.
Contact support: For immediate assistance, reach out to Sanity support. They can check if your IP is blocked and potentially remove the block manually. Be sure to include:
- Your project ID
- The IP address that's blocked (you can find this at https://whatismyipaddress.com/)
- The timestamp when the rate limit error occurred
Preventing future occurrences:
- Use the API CDN (
apicdn.sanity.io) which has unlimited rate for cached content - this is particularly helpful since cached responses won't count against rate limits - Implement request throttling in your code
- Use proper caching strategies to reduce API calls
- Consider batching requests where possible
- Configure your Sanity client with
useCdn: trueto take advantage of the CDN
If you're in active development and hitting rate limits, you might want to review your query patterns to see if you're making unnecessary requests (like queries in tight loops or on every keystroke). The good news is that this is typically a temporary issue that resolves itself, but support can definitely help if you need immediate access!
Show original thread18 replies
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.