Hi all,
I have a project where I show certain data about cities. Since those data rarely change, I want to generate static pages for ca. 1000 cities, using generateStaticParams(). If the requested city is not among the generated pages, the data should be fetched from the database (Supabase) on the fly. So it’s pretty usual SSG / ISG stuff.
My code works on localhost completely fine. I build with “npm run build && npm start“, visit a page in the “static” list, and get the static page instantly. I see no request hitting the DB. I see the following (cache related) response headers:
cache-control s-maxage=86400, stale-while-revalidate=31449600
vary RSC, Next-Router-State-Tree, Next-Router-Prefetch, Next-Router-Segment-Prefetch, Accept-Encoding
x-nextjs-cache HIT
x-nextjs-prerender 1
x-nextjs-stale-time 300
But as soon as I deploy it to Vercel, the pages never get served them from static cache. Vercel always generates them dynamically. I always see DB hits after the request. And the response headers show that:
age 0
cache-control public, max-age=0, must-revalidate
server Vercel
strict-transport-security max-age=63072000
vary RSC, Next-Router-State-Tree, Next-Router-Prefetch, Next-Router-Segment-Prefetch
x-matched-path /monthly/italy/bolzano/3181913
x-nextjs-prerender 1
x-nextjs-stale-time 300
x-vercel-cache PRERENDER
Do you have any idea what might cause this?