Sanity production dataset returning "Internal Error", staging works fine
This "Internal error" showing up specifically on your production dataset while staging works fine is typically caused by a backend issue with your production dataset. The listen.js errors with onChannelError and coerceError indicate that Sanity Studio is having trouble establishing or maintaining a connection to your production dataset's API, likely related to the real-time listener functionality that keeps Studio in sync with content changes.
Here are the most common causes and how to troubleshoot:
1. Dataset Corruption or Index Issues (Most Likely)
Since staging works perfectly but production doesn't, this strongly suggests your production dataset has encountered an indexing issue or data corruption on Sanity's backend. This isn't something you can fix yourself.
Action: Contact Sanity support immediately. They can check the backend health of your production dataset, review server logs, and reindex if needed. Since this is affecting production, mention the urgency and they'll prioritize it.
2. API Token or Permission Problems
If you recently changed API tokens or roles/permissions, production might have different access requirements than staging.
Check:
- Verify your environment variables aren't accidentally using different API tokens between datasets
- Go to sanity.io/manage → Your Project → API settings to ensure production dataset permissions are correct
- If using custom roles, verify they're configured properly for production
3. Configuration Mismatch
Double-check your Studio configuration:
// In your sanity.config.ts
export default defineConfig({
projectId: 'your-project-id',
dataset: 'production', // Verify this matches exactly
// ...
})4. CORS Settings
Production datasets might have different CORS configurations.
Check: Go to sanity.io/manage → Your Project → API → CORS Origins and verify your Studio URL is allowed for the production dataset.
Immediate Steps
- Check platform status: Visit status.sanity.io to rule out any ongoing incidents
- Clear cache and rebuild: Run
sanity deployagain or clear your browser cache completely - Check browser console: Look for any additional error messages that appear before the "Internal error"
- Try the API directly: Test if you can query your production dataset using the Vision plugin or a simple GROQ query to see if it's just a Studio issue or a broader API problem
Since this is blocking your production environment and staging works fine, this is almost certainly a backend issue that requires Sanity support to investigate. They have access to server-side logs and dataset health metrics that you don't. Reach out through the help widget in your Studio or at sanity.io/contact/support - they're usually very responsive for production issues.
Show original thread8 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.