Hi everyone, I use vercel to deploy my project. One of my NextJS project dependencies, located inside node_modules, reads and writes files in its own folder. When I import this dependency, I get the following error:
"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: EROFS: read-only file system, chmod '/var/task/node_modules/MY_DEPENDENCY/src/FILE'"
Is there a solution?
You did not mention what the project dependency does, however its generally an anti-pattern to use serverless functions to write files as there is no guarantee of existence on the next invocation
Potential directional Solves
It might be better for you depending on the type of file written (assets or flat files ) to a bucket like S3 OR to a database - There are multiple ways to accomplish writing of shared state between functions.