Sanity changes not visible on live site despite revalidate setting

13 replies
Last updated: Jan 28, 2026
Hello. I have a Next JS + Sanity project. Some thank you/error messages also come from Sanity in this project. But there is one problem. Although I change the information in Sanity, the changes only take effect locally. This is the case even though there is dataset production. On the live website, the changes are not visible. What could be the reason for this and how do I solve it?
"
https://www.sanity.io/answers/changes-made-in-my-production-studio-arent-affecting-my-website " The link here mentions editing the revalidate values.
"`export async function getStaticProps({ preview = false }) {`

const data = await getClient().fetch(query);


return {

props: { preview, data },

revalidate: 10,

};

}

`export default HomePage;`"

But as you can see in these codes, it is already set to a very short time in the project. Why aren't the changes visible on the live site though?
AI Update

Based on your issue, the problem is likely that you have multiple caching layers working against each other. Even though you've set revalidate: 10, you're probably still using the Sanity CDN (useCdn: true) in your client configuration, which can serve cached content independently of your Next.js ISR settings.

Here's what's happening: When Next.js revalidates and fetches "fresh" data from Sanity, the Sanity CDN may still serve cached content from its own cache layer. This means your ISR revalidation is working, but it's just fetching stale data from Sanity's CDN.

The Solution

In your Sanity client configuration, set useCdn: false for production queries:

import { createClient } from 'next-sanity'

const client = createClient({
  projectId: 'your-project-id',
  dataset: 'production',
  apiVersion: '2023-01-01',
  useCdn: false, // Critical: disable Sanity's CDN for ISR
})

Or if you're using the getClient() pattern, make sure it's configured properly:

export function getClient(preview) {
  return createClient({
    projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID,
    dataset: process.env.NEXT_PUBLIC_SANITY_DATASET,
    apiVersion: '2023-01-01',
    useCdn: false, // Disable for production to work with ISR
    token: preview ? process.env.SANITY_API_TOKEN : undefined,
  })
}

Why This Works

As explained in the ISR documentation, when using ISR with external APIs that have their own CDN (like Sanity), it's recommended to disable the external CDN (useCdn: false) to ensure fresh data during revalidation. The Sanity CDN and Next.js ISR can work at cross-purposes, potentially serving stale data. By setting useCdn: false, you query Sanity's API directly, ensuring you get the latest published content during revalidation.

Alternative: On-Demand Revalidation

For instant updates (like fixing typos in those thank you/error messages), consider implementing on-demand ISR with webhooks. This triggers revalidation immediately when content changes in Sanity:

  1. Create an API route in Next.js:
// pages/api/revalidate.js
export default async function handler(req, res) {
  // Validate the request (check for a secret token)
  if (req.query.secret !== process.env.REVALIDATE_SECRET) {
    return res.status(401).json({ message: 'Invalid token' })
  }

  try {
    await res.revalidate('/your-page-path')
    return res.json({ revalidated: true })
  } catch (err) {
    return res.status(500).send('Error revalidating')
  }
}
  1. Set up a webhook in Sanity Studio to call this endpoint when documents change

Modern Alternative: Sanity Functions

Even better than webhooks, you could use Sanity Functions which provide serverless compute directly within Sanity. Functions can listen to document changes and trigger your revalidation endpoint without needing external webhook infrastructure. This is the modern, recommended approach for reacting to content changes.

This gives you both the performance benefits of static generation and instant content updates when needed. The useCdn: false change should fix your immediate issue, while on-demand revalidation (via webhooks or Functions) provides instant updates for critical content changes.

Show original thread
13 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?