`EROFS: read-only file system, chmod '/var/task/generated/prisma-client/runtime/query-engine-rhel-openssl-1.0.x'`
See original GitHub issueI followed the setup in https://github.com/prisma/prisma2-e2e-tests/tree/master/platforms/netlify (clone, remove .netlify/state.json, yarn install, yarn prisma2 generate, execute commands from build.sh manually (zip does not exist and has to be done manually), get deployed site and function!).
When then calling the function, I get:
{"errorType":"Error","errorMessage":"\nInvalid `prisma.()` invocation in\n/var/task/generated/prisma-client/index.js:323:37\n\n\n\nEROFS: read-only file system, chmod '/var/task/generated/prisma-client/runtime/query-engine-rhel-openssl-1.0.x'","trace":["Error: ","Invalid `prisma.()` invocation in","/var/task/generated/prisma-client/index.js:323:37","","","","EROFS: read-only file system, chmod '/var/task/generated/prisma-client/runtime/query-engine-rhel-openssl-1.0.x'"," at PrismaClientFetcher.request (/var/task/generated/prisma-client/index.js:60:27)"]}
https://goofy-tereshkova-4bf91a.netlify.com/.netlify/functions/index
Theory: Because the the generated client was created on Windows, it is missing the necessary file permission flags.
(index.zip that was uploaded: index.zip)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:35 (15 by maintainers)
Top Results From Across the Web
Trying to create a file in Android: open failed: EROFS (Read ...
I have tried this with and without the WRITE_INTERNAL_STORAGE permission. There is no WRITE_INTERNAL_STORAGE permission in Android.
Read more >Chmod error changing permission read only file system
I've faced a similar problem with an SD Card previously used on an Android device and locked in READ ONLY mode.
Read more >EROFS - Enhanced Read-Only File System
EROFS filesystem stands for Enhanced Read-Only File System. It aims to form a generic read-only filesystem solution for various read-only use cases instead ......
Read more >Read-only file system - Unix & Linux Stack Exchange
Your filesystem is read-only, probably because it is damaged. This has nothing to do with the file permissions.
Read more >chmod command fails with "Read-only file system"
Hi all, I'm getting a "Read-only file system" error when I try to do the chmod, mkdir, touch, or rm commands. I suspect...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

In my understanding, this issue happens when the build machine is an OS without binary flags (like windows) and the deployment machine is a machine with binary flags.
If you specify a binary provider in your Prisma schema file to download the binary for target platform OS, like in the case of netlify:
binaryTargets = ["native", "rhel-openssl-1.0.x"]The binary download happens with
prisma2 generateon the build OS (windows). But the downloaded binary doesn’t have any executable flag as it is on windows.When this binary is deployed a Prisma client attempts to run it, it fails. Most likely on this line. This would usually just work but on lambda it doesn’t work because this part of the filesystem is not writeable.
Next steps: We need to validate the above hypothesis and solve this in some way (already have +x flag on binaries in S3 or downloading the files in
/tmp(writeable for lambda) adding the +x flag and copying the binary or something else)Copy to tmp folder works for me.
And need an env: