Changes Made in My Production Studio Aren't Affecting My Website

4 replies
Last updated: Sep 30, 2022
Hi everyone,
I noticed that changes made in my production studio don't seem to be affecting my production website anymore, but they do take place on
localhost:3000
. Changes made to the local studio on
localhost:3333
also seem to take place locally, but not on production. Additionally, any changes made to the local studio can be seen in the production studio, but again not on the production website.
The changes only seem to occur on production once I manually commit new changes and trigger a redeploy on Vercel.

I noticed that this only started happening in the last week or so, and the only thing I can really think of is that sometime between here and then I was removing/reinstalling node_modules in both my studio and web folders within my monorepo due to some dependency issues I had with
sanity-plugin-color-picker
. I don't think it's a configuration issue because my dataset is set to production in my API settings on Sanity & in my sanity.json ( I also haven't touched this since the start of the project, and I know it was working previously).
Does anyone have any advice for how I should go about debugging this?
AI Update

This is a classic caching issue! Your content changes are making it to Sanity's production dataset just fine (that's why you see them in the production Studio), but your production website isn't picking them up. The fact that manual deploys fix it temporarily is the key clue.

Here's what's likely happening: Your Next.js site is using static generation (SSG) and was previously configured to automatically revalidate when content changed, but that automatic revalidation has stopped working. When you manually redeploy on Vercel, it rebuilds all the static pages with fresh data, which is why you see the changes then.

What to Check

1. Webhook Configuration

If you were using webhooks to trigger on-demand revalidation, check that your webhook is still properly configured in Sanity:

  • Go to your Sanity project dashboard → API → Webhooks
  • Verify your webhook URL is correct and pointing to your production domain
  • Check the webhook logs to see if it's firing successfully
  • Make sure the webhook secret (if you're using one) matches what's in your Vercel environment variables

2. Revalidation Settings

If you're using time-based ISR (Incremental Static Regeneration), verify your revalidate values are still set in your data fetching:

export async function getStaticProps() {
  const data = await client.fetch(query)
  return {
    props: { data },
    revalidate: 60 // Should have a revalidate value
  }
}

3. Sanity Client Configuration

Check your Sanity client configuration in your production site. You should have useCdn: false for ISR to work properly, as the Sanity CDN can serve stale cached data that conflicts with Next.js's revalidation:

const client = createClient({
  projectId: 'your-project-id',
  dataset: 'production',
  apiVersion: '2024-01-01',
  useCdn: false, // Important for ISR!
})

4. Environment Variables

After your node_modules reinstall, double-check that all your environment variables are still correctly set in Vercel (not just locally). Missing or incorrect API tokens could prevent revalidation from working.

The Fix

The most reliable modern approach is to set up on-demand revalidation with webhooks. This triggers revalidation immediately when content changes in Sanity, rather than waiting for time-based intervals.

Alternatively, consider using Sanity Functions (the newer, recommended approach) to handle content change events and trigger revalidation without needing external webhooks or hosting your own API routes.

Since this started after your dependency reinstall, I'd bet something got reset in either your webhook configuration or your Vercel environment variables. Start by checking those two things first!

Site is built with Next.js right? What do you have set for revalidation (if at all) on the pages that aren’t updating? By default data fetched in
getStaticProps
is only going to update every build unless
revalidate
is set or on-demand revalidation is set up.

https://nextjs.org/docs/basic-features/data-fetching/incremental-static-regeneration
Ahhhh yup, that's almost certainly the issue. I was missing
revalidate
in some pages. Adding those rn and committing to see if that resolves it
It worked! Thanks you so much. Can't believe I didn't catch that 😵‍💫
No worries 👍

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?