I’m trying to add JSON localization for my NodeJS app.
Everything works just fine in my local env but when I upload the code to Lambda function, it does not work anymore.
This is my locale files in my local env
It looks like the lambda function is unable to write the below files:
- /src/locales/en.json
- /src/locales/vi.json
This is the error related to the read-only issue.
2024-06-07T13:25:29.280Z undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"EROFS: read-only file system, mkdir '/var/task/locales'","code":"EROFS","errno":-30,"syscall":"mkdir","path":"/var/task/locales","stack":["Error: EROFS: read-only file system, mkdir '/var/task/locales'"," at Object.mkdirSync (node:fs:1372:26)"," at write (/opt/nodejs/node_modules/i18n/i18n.js:1286:12)"," at read (/opt/nodejs/node_modules/i18n/i18n.js:1265:7)"," at Array.forEach (<anonymous>)"," at Object.i18nConfigure [as configure] (/opt/nodejs/node_modules/i18n/i18n.js:220:21)"," at Object.<anonymous> (/var/task/i18n.js:8:16)"," at Module._compile (node:internal/modules/cjs/loader:1358:14)"," at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)"," at Module.load (node:internal/modules/cjs/loader:1208:32)"," at Module._load (node:internal/modules/cjs/loader:1024:12)"]}
I’m using:
- NodeJS v20
- Express v4.19.2
- i18n v0.15.1
I’m using:
- NodeJS v20
- Express v4.19.2
- i18n v0.15.1