Deployed Sanity Studio won't complete publish but saves drafts locally

25 replies
Last updated: Dec 1, 2025
HALP! I am having trouble publishing data on my deployed studio with Sanity. When I run the studio locally, I can change data and click publish and I see the toast immediately that it was published. My deployed studio doesn't show the toast and the publish button just stays green in limbo. I can refresh the studio and see that my changes are present in the editor, so it seems the draft is being saved but not published, because I can then reload my local development copy and it was publish right away with that drafted change.
Does anyone know why my deployed studio won't complete the publish process?
AI Update

This is a frustrating issue, but the good news is it's usually solvable! The symptoms you're describing - drafts saving but publish hanging without a toast - typically point to one of a few common deployment configuration issues.

Most Likely Cause: CORS Origins

The most common reason for this behavior is that your deployed Studio's domain hasn't been added to your project's CORS (Cross-Origin Resource Sharing) origins. When your Studio tries to publish, it needs permission to make authenticated API requests to Sanity's servers. Without proper CORS configuration, the publish mutation gets blocked by the browser.

To fix this:

  1. Go to manage.sanity.io
  2. Select your project
  3. Navigate to Settings → API → CORS Origins
  4. Click Add CORS origin
  5. Enter your deployed Studio's full URL (e.g., https://your-studio.vercel.app)
  6. Important: Check the "Allow credentials" box
  7. Save

The "Allow credentials" checkbox is crucial - without it, authenticated requests (like publishing) will fail even if the domain is whitelisted.

Other Potential Issues to Check

1. Configuration File Issues

Verify your sanity.config.js (or .ts) has the correct projectId and dataset properly defined. According to the configuration documentation, these should be set in your config file:

import { defineConfig } from 'sanity'

export default defineConfig({
  projectId: 'your-project-id',
  dataset: 'production',
  // ... rest of config
})

If you're using environment variables for these values, make sure they're prefixed with SANITY_STUDIO_ (as explained in the environment variables documentation) and are properly set in your hosting platform (Vercel, Netlify, etc.) - not just in local .env files.

2. Build vs Runtime Configuration

Since drafts are saving but not publishing, your Studio is partially connected to Sanity (it can write drafts) but something is blocking the publish mutation specifically. This often happens when:

  • The Studio was built with correct config but CORS wasn't set up for the deployed domain
  • Authentication headers are being blocked due to missing "Allow credentials" in CORS settings

3. Check Browser Console

Open your browser's developer console on the deployed Studio and try to publish. Look for:

  • CORS errors mentioning "Access-Control-Allow-Origin"
  • Network requests to *.api.sanity.io that are failing
  • Any mutation errors in the console

These will give you specific clues about what's failing.

Why It Works Locally

Your local Studio works because http://localhost:3333 (or whatever port you're using) is likely already in your CORS origins, or the browser treats localhost differently for security purposes.

Try adding the CORS origin first - this solves the issue in about 90% of cases with these exact symptoms. If that doesn't work, check the browser console for specific error messages and come back with those details for more targeted troubleshooting!

Show original thread
25 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.

Was this answer helpful?