Old V2 project internal links suddenly stopped working overnight
This sounds like you've been hit by a recent breaking change in Sanity's API! On February 24, 2025, Sanity released API version 2025-02-19 which changed the default perspective from raw to published.
This is likely why your internal links stopped working overnight - if your references point to draft documents or you're querying for linked content, the API is now only returning published documents by default instead of all documents (drafts + published).
Quick fix:
You need to explicitly set the perspective parameter in your queries. Depending on how you're querying:
For GROQ queries:
const query = '*[_type == "post"]'
const params = { perspective: 'raw' } // or 'previewDrafts'
const data = await client.fetch(query, params)For client configuration:
const client = sanityClient({
// ... other config
perspective: 'raw', // Add this to maintain previous behavior
useCdn: false // You'll want CDN off for draft content
})The raw perspective gives you the old behavior (both drafts and published docs), while previewDrafts gives you drafts with published as fallback.
If you're using GraphQL, you'll need to add the perspective parameter there as well.
This change happened automatically when Sanity updated their API version, even if you haven't touched your project. The good news is it's a straightforward fix once you know what's happening!
Show original thread4 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.