-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Error: EROFS: read-only file system, open 'metadata.json'. => I used Firebase Functions. I deployed their json file. I can't able to write that json #920
-
Error: EROFS: read-only file system, open 'metadata.json'
at Object.openSync (fs.js:498:3)
at Object.writeFileSync (fs.js:1524:35)
at /workspace/index.js:113:8
at Layer.handle [as handle_request] (/workspace/node_modules/express/lib/router/layer.js:95:5)
at next (/workspace/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/workspace/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/workspace/node_modules/express/lib/router/layer.js:95:5)
at /workspace/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/workspace/node_modules/express/lib/router/index.js:335:12)
at next (/workspace/node_modules/express/lib/router/index.js:275:10) {
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
You're attempting to write to a read-only file system. Firebase Cloud Functions have a read-only file system except for the /tmp directory.
Solution:
Use /tmp: Change the code to write the metadata.json file into the /tmp directory.
const fs = require('fs'); const path = '/tmp/metadata.json'; fs.writeFileSync(path, yourData);
Note that /tmp is temporary storage, so files should be deleted when no longer needed.
Beta Was this translation helpful? Give feedback.