Unlock seamless workflows and faster delivery with our latest releases – get the details

Content changes in Sanity not updating on deployed Next.js site

5 replies
Last updated: Sep 29, 2021
Hi, I'm working on a sanity project whose previous developer that started the project is no longer here. Meaning there are a few gaps of sanity knowledge that are missing on my end. Maybe someone can help with this:

THE ISSUE - Content changed on Sanity studio doesn't update on our deployed staging site. The only time changes occur if I manually have to make a manual push to our git repo which builds the vercel hosted site.

THE CURRENT BEHAVIOR• When updating things locally, everything works out fine. So the studio hosted on
localhost:3333
applies the changes to the site running on
localhost:3000
.• Funny enough, if I have my
localhost:3000
site running and update something on our organization's sanity studio ... those changes are reflected immediately on my localhost site 🤔• Any changes made on our organization's sanity studio do not get reflected on the staging site.

Note: The project I'm working on is made with Next.js X Sanity. It is initially bootstrapped from the Sanity/Next eCommerce Starter


If I could get any lead on where to start looking to align the CMS changes to our site, it would be great. Thanks 🙏
Sep 29, 2021, 10:43 AM
Hi User, from the way you describe the issue it sounds like your Nextjs frontend is being deployed statically, and only get updated when you manually trigger deploy.
You can fix it by creating a new webhook for your staging site on vercel (see vercel docs for more info), then add it to your sanity project, either via the UI at
sanity.io/teams or via the command line.
NextJS when run locally will act as a single page app, meaning everytime you update data in the studio (deployed or local), it will refetch the data every refresh. You’re probably using the same dataset, that’s why changes in the deployed studio reflected immediately in local site.

Alternatively, if possible you can change the way you deploy your NextJS app so that data get updated automatically without re-deploying the site everytime. Please note that there are trade off, depending on your site’s traffic & size you may see increase or decrease api call / bandwidth usage
https://nextjs.org/docs/basic-features/data-fetching#incremental-static-regeneration
Sep 29, 2021, 11:08 AM
You can also install this plugin for manually trigger a rebuild that brings in the new content https://www.sanity.io/plugins/vercel-deploy
Or wait for our new webhooks to launch and automate it!
Sep 29, 2021, 11:38 AM
Thanks to both of you! I'll look into these
Sep 29, 2021, 12:22 PM
user Y
When are the new webhooks planned for?
Sep 29, 2021, 12:27 PM
Very soon 🙂
Sep 29, 2021, 12:27 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?