Next.js Discord

Discord Forum

Unstable cache behaves differently in next start vs in vercel hosting

Unanswered
Siamese Crocodile posted this in #help-forum
Open in Discord
Siamese CrocodileOP
Hi. My structure looks like this:

I've a dynamic rendered page - vip which uses data thats in unstable_cache and should never revalidate.
When building an app locally and entering http://localhost:3000/en/vip and refreshing page many times In my logger I see that the data is cached properly and requests never run no matter how many times I refresh the page.
When I try the same on app thats hosted on vercel every time i enter /en/vip page takes a lot longer to load and In my request middleware I see that cache is not respected at all. Every request we do 4 requests to backend to get the data that should be cached. What could be causing this strange behaviour? Where should I start looking?

11 Replies

Siamese CrocodileOP
And as comparison logs when using next start and refreshing /en/vip 10 times
nothing is there 😄
Siamese CrocodileOP
Lol
Adding keyparts and options causes it
const data = unstable_cache(fetchData, keyParts, options)()
and only on dynamic pages
and only on vercel
locally it doesnt affect it when running next start
isnt it a bug?
American Crow
well it got unstable in its name for a reason, so very likely