GraphQL API fetch errors linked to backend update rollback
I can see you're experiencing a network-level error (UND_ERR_SOCKET with "other side closed") when trying to fetch from Sanity's GraphQL API. This type of error indicates the connection is being terminated unexpectedly, which can have several causes.
Understanding the error:
The TypeError: terminated with the underlying SocketError: other side closed from undici (Node's HTTP client) means your request started but the connection was closed before completing. This is a network/connection issue rather than a GraphQL query problem.
Possible causes:
- Network/Infrastructure issues: Could be related to Sanity's infrastructure, your hosting provider, or network path between them
- Rate limiting: If you're making many requests (especially during development with hot reload), you might be hitting rate limits
- Timeout issues: Large GraphQL queries or slow responses timing out
- DNS/routing problems: Issues resolving or reaching Sanity's API servers
- Local network issues: Firewall, proxy, or ISP interference
Immediate troubleshooting steps:
Check Sanity's status: Visit sanity-status.com to see if there are any ongoing incidents. If there's an active incident, you'll need to wait for Sanity's team to resolve it.
Verify your endpoint: Ensure you're using the correct GraphQL API endpoint format. The GraphQL API should be deployed using
sanity graphql deployand accessed at your project's apicdn domain.Test with GROQ as a workaround: While troubleshooting, you can use GROQ queries via the HTTP API as an alternative to verify if the issue is specific to GraphQL or affects all API access.
Network diagnostics:
- Try from a different network (mobile hotspot, different WiFi)
- Flush your DNS cache
- Check if you can reach the endpoint with curl to test basic connectivity
Code-level fixes:
- Add retry logic with exponential backoff
- Increase timeout values in your fetch configuration
- If using Next.js, check if you're hitting this during build vs runtime
Check for rate limiting: If you're fetching the GraphQL schema on every build or hot reload, you might be hitting rate limits. Consider caching the schema or reducing fetch frequency during development.
If the issue persists:
Since this started 2 days ago and involves connection termination, it could be infrastructure-related. I'd recommend:
- Contact Sanity support with your project ID, dataset name, and this error trace
- Include details about when it started, how frequently it occurs, and whether it affects all environments or just specific ones
- Ask support if there were any infrastructure changes around the time the issue started
The error you're seeing is at the network/transport layer rather than the GraphQL application layer, which suggests either infrastructure issues or network connectivity problems between your application and Sanity's API servers. The status page will show if there's a known incident, but if everything appears operational there and you're still experiencing issues, support can investigate your specific project.
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.