
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeLooking at your setup, the issue is that the Contributor role doesn't have sufficient permissions to read drafts. According to the roles documentation, the Contributor role only has "create" mode access, which allows reading and writing to draft content but cannot read published documents or use the previewDrafts perspective.
Here's what's happening:
Contributor permissions:
create (can create/edit drafts but limited read access)perspective: 'previewDrafts'drafts.)Why it works in dev mode: In development, you're likely authenticated with your personal user account (which probably has Administrator or Editor role), so you have full access.
Solution options:
Use a Viewer or Editor token (recommended for preview):
mode: 'read' and history: trueCreate a new API token in Sanity Manage with Viewer or Editor role instead of Contributor.
Add the perspective parameter to your client config:
const sanityAuthClient = sanityClient.withConfig({
token: import.meta.env.SANITY_API_TOKEN,
useCdn: false,
perspective: 'previewDrafts', // This requires Viewer+ role
});For Astro SSR on Vercel specifically, you'll want to:
useCdn: false (you already have this ✓)perspective: 'previewDrafts' to prioritize drafts over publishedapiVersion to match your datasetQuick fix: Go to your project's API settings, create a new token with Viewer role, and use that instead. Viewer tokens can read both drafts and published documents, which is exactly what you need for preview functionality on Vercel.
The Contributor role is designed for users who can create/edit content but shouldn't necessarily see everything - it's more restrictive than you need for a preview environment. For accessing drafts via the API (especially with perspectives like previewDrafts), you need at least Viewer-level permissions.
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