Save json with fs from Next.js backend on Vercel
Unanswered
SplashMaster posted this in #help-forum
Hi all,
I tried to write json file on backend - api so build system of it with fs npm module.
and it works as well on my local development environment but not working on production mode deployed by vercel.
It seemed only read-only stream.
Do you have any idea for this problem ?
Hope to discuss further.
thx for interesting.
🔥
I tried to write json file on backend - api so build system of it with fs npm module.
and it works as well on my local development environment but not working on production mode deployed by vercel.
It seemed only read-only stream.
Do you have any idea for this problem ?
Hope to discuss further.
thx for interesting.
🔥
11 Replies
Hi @SplashMaster, could you show me the snippet / route you currently make use of?
also the path of your file
Vercel file system is read only
You need external storage like a db or s3
When working with vercel
https://vercel.com/guides/how-can-i-use-files-in-serverless-functions seems to be able to create files too
You can write to the file system
Buts it’s ephemeral
Once the container spins down
The data will be lost
I see in the docs in deed, but i think the link will be enough to figure out how the s3 bucket could be connected