Functions: Archive file with os.tmpdir() lead to Error: EROFS: read-only file system

As far as I can understand Lambda has 500mb of persisted disk.

Currently getting the following error β†’ the function I am using is the following

Code can be found here: GitHub - omarsotillo/nativeto: WIP πŸ‘·πŸ»β€β™‚οΈ and the failing function
nativeto/nativeto.js at master Β· omarsotillo/nativeto Β· GitHub

With netlify dev everything works fine.

Hi, @omarsotillo, there is no persistent filesystem with the AWS Lambda instances used by Functions. That filesystem provided is read-only.

Thanks for the response though I don’t agree. I have used it before not with netlify though. Probably a custom AWS lambda implementation here.

See the docs:

Q: What if I need scratch space on disk for my AWS Lambda function?
Each Lambda function receives 500MB of non-persistent disk space in its own /tmp directory.

Yes, the /tmp folder is accessible. But it is non-persistent. As @luke mentioned, there is no persistent filesystem on functions deployed through Netlify. The FAQ you quoted confirms that the 500MB is non-persistent.

Hi, @omarsotillo, you are right. The /tmp is read/write and I was wrong about that.

I also noticed that the error message mentions not being able to write to /home/sbx_user1051. The /home directory is read-only. Have you tried writing to /tmp instead?