Next.js Discord

Discord Forum

fs problem

Unanswered
Whiteleg shrimp posted this in #help-forum
Open in Discord
Whiteleg shrimpOP
so i'm using fs on my next js app and i have a problem where when i read a file use fsReadFileSync it returns with the old file content and not the current file content

JSON.parse(fs.readFileSync('./storage/general.json'));
^ example

5 Replies

Satin Angora
So off the top of my head I immediately jump to potentially a caching issue. Are you calling this using a server component? Where are you having issues with this locally specifically or on a platform like vercel? (This may be the main issue of this if you're hosting on a serverless platform)
Satin Angora
What VPS service are you using im assuming something like vercel where its serverless?
Whiteleg shrimpOP
windows vps
const Page = () => {
let blabla= JSON.parse(fs.readFileSync('./storage/file.json'));

return #Unknown Channel
...
</>