I try to build an app through Nextjs, it is my first one. I've been building it successfully on the local environment, so I decided to publish it with my own domain, etc. I published it through Vercel. Here the thing: I have a json file where I read and write data into it. As I would like to get access to it, I put it in my public folder (no sensitive data at all) On the localhost environment
let content = await JSON.parse(fs.readFileSync('public/email.json'), 'utf8'))
works perfectly well and allows me to get access to the data. I have a same process for writing data
But when I pushed the data on the dev/prod environement, it does not work and I get those kind of error
{"error":{"errno":-2,"syscall":"open","code":"ENOENT","path":"public/email.json"}}
I've tried multiple things to correct the error, but as of today it was not possible to get access to email.json data
let content = await JSON.parse(fs.readFileSync(path.resolve(__dirname, 'email.json'), 'utf8'))
I'm sharing also my source code, through a screenshot, once it is deployed in Vercel Vercel source code