Next.js Discord

Discord Forum

mongodb data outdated after deploy on vercel

Unanswered
Kombai posted this in #help-forum
Open in Discord
KombaiOP
after a get request on mongo db it seems its working fine in localhost
but when in production on vercel the data is outdated..
when i delete a user and refresh the page it seems that the data stays the same in front end but the user is deleted in mongodb

7 Replies

cache issue prolly
Simple solution is revalidation
Add this line in your route.ts
export const revalidate = 0 
And make sure to fetch('....',{cache:"no-store"...})
KombaiOP
i use get action im not using fetch should i change this?
and i use this get in the component
KombaiOP
i changed the getOrders action to this and it worked.. i dont get it yet why the first function works on localhost and not when deployed on vercel but it works now.. thank you