✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Next.js on Netlify Returns Stale Data for Specific Document Type

4 replies
Last updated: Jun 30, 2021
I got a curious issue with deploying NextJS on Netlify where a preview (/api/preview?…etc.; I’m not using PreviewSubscription at the moment) for a specific document type get SSR-ed’ perfectly fine locally with
next build && next start
, but when deployed, always returns stale data.
It doesn’t happen with other document types. Logging of the deployed functions show the same configurations (correct token, correct document id, useCdn: false). I’m super puzzled — any one had this issue before?
Jun 24, 2021, 2:23 PM
Is it possible you’re seeing caching of the static page vs the client refreshing the json for a page (and client side rendering it with more recent data)? I haven’t fully explored this but hard refreshes on some of our pages will result in old data but getting there by a client side router link will show up to date data. Maybe these are related? Sorry if not
Jun 24, 2021, 3:39 PM
Thanks Chris, that sounds like a possibility — I’ll check
Jun 25, 2021, 12:15 AM
just wanna circle back to share the issue that I ran into: https://github.com/netlify/netlify-plugin-nextjs/issues/440
Jun 30, 2021, 5:32 AM
Netlify’s on-builder functions send me cached response on preview pages
Jun 30, 2021, 5:35 AM

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?