
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThis error typically indicates that the Sanity API is returning an invalid or unexpected response during your Nuxt build or runtime, causing Nitro (Nuxt's server engine) to fail. Since nothing changed in your repo but deployments suddenly stopped working both locally and on Netlify, this strongly points to an upstream issue rather than a code problem.
First, check if there's an ongoing incident affecting Sanity's services. Look for Sanity's official status page or check their social media channels and community forums for any service disruption announcements. If the API or CDN is experiencing issues, you'll likely see reports of 502 errors or degraded service from other users.
To get more details about what's failing, enable debug logging in your Nuxt app:
# Locally
NITRO_DEBUG=1 DEBUG=nitro:* npm run dev
# Or for more detailed fetch logging
DEBUG=ofetch:* npm run devThis will show you exactly which Sanity API requests are failing and what responses you're receiving.
Even though nothing changed in your repo, verify your Sanity client setup. If you're using the @nuxtjs/sanity module, ensure your configuration is correct:
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@nuxtjs/sanity'],
sanity: {
projectId: 'your-project-id',
dataset: 'production',
apiVersion: '2024-01-01', // Use a specific date
useCdn: true
}
})API Version Issues: According to the API versioning documentation, Sanity uses date-based API versions. If you're not explicitly specifying an apiVersion, you might be affected by changes in default behavior. Always specify a version to avoid unexpected changes.
CDN/Network Issues: Sanity uses a CDN, and 502 errors often originate from CDN-level problems during incidents or network disruptions.
Query Timeout: If you have complex GROQ queries, they might be timing out intermittently due to upstream load or temporary performance issues.
While waiting for upstream issues to resolve, try these approaches:
// If using the Sanity client directly
import { createClient } from '@sanity/client'
const client = createClient({
projectId: 'your-project-id',
dataset: 'production',
apiVersion: '2024-01-01',
useCdn: true,
timeout: 30000, // 30 seconds
})sanity: {
projectId: 'your-project-id',
dataset: 'production',
apiVersion: '2024-01-01',
useCdn: false // Temporarily disable CDN
}This bypasses the CDN and hits the API directly, which can help isolate CDN-specific issues.
If there are no reported service issues, try:
SANITY_PROJECT_ID, SANITY_DATASET, and any authentication tokens are set correctly in NetlifyapiVersion in your configuration rather than relying on defaultsSince you're experiencing this both locally and on Netlify with no code changes, and the last deployment from Sanity Studio worked fine, this strongly suggests a temporary API or network connectivity issue. The fact that it's happening in multiple environments simultaneously is a strong indicator of an upstream problem rather than a configuration issue in your code.
Monitor for any service status updates and try redeploying once any incidents are resolved. In the meantime, the debug logging should help you identify exactly which requests are failing and provide more context for troubleshooting or reporting the issue to Sanity support.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store