Vercel - Next js Error on write
Unanswered
Brown bear posted this in #help-forum
Brown bearOP
Hi everyone I am using a library that allows me to use mdx files and create static pages
I have created a cms with this library that by creating new files, allows me to have new pages.
I uploaded on vercel, my app in nextjs but it tells me that I don't have permissions to do the write how can I solve this problem?
I have created a cms with this library that by creating new files, allows me to have new pages.
I uploaded on vercel, my app in nextjs but it tells me that I don't have permissions to do the write how can I solve this problem?
8 Replies
@Brown bear Hi everyone I am using a library that allows me to use mdx files and create static pages
I have created a cms with this library that by creating new files, allows me to have new pages.
I uploaded on vercel, my app in nextjs but it tells me that I don't have permissions to do the write how can I solve this problem?
you cannot write to the vercel file system*, so you have to save your content to a db
* you can write, but only to
* you can write, but only to
/tmp which will be destroyed when your serverless function endsBrown bearOP
Yes I also save it in the database but to create the static pages I need this file...
Otherwise I wouldn't know how to do it
Otherwise I wouldn't know how to do it
@joulev you cannot write to the vercel file system*, so you have to save your content to a db
\* you _can_ write, but only to `/tmp` which will be destroyed when your serverless function ends
Brown bearOP
If you could give me some tips to avoid dynamic pages.
to create the static pages I need this fileno you don't – you can always store the file content in a db and read it because your databases are writable, but you cannot do that for the vercel fs because it is not writable (due to the serverless architecture). if you need to host where the fs is writable, you need to get a running server as serverless is not compatible with that
@Brown bear If you could give me some tips to avoid dynamic pages.
dynamic here, as in: [dynamic rendering](https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering) or [dynamic segments](https://nextjs.org/docs/app/building-your-application/routing/dynamic-routes)?
Brown bearOP
You say save it in an aws bucket and read it from there to use a serveless server?
i say that vercel fs is not writable so you need to write that to somewhere else. you choose - a db works, aws s3 works, anything that can store data will work
Brown bearOP
I just don't know if the library is compatible I am using contentlayer it allows me to read files inside a bucket