0

I have deployed my expressjs code to lambda using claudiajs.When I hit the API endpoint generated every alternate request gives me internal server error.I checked the logs and found this

 "errorType": "Error",
    "errorMessage": "EROFS: read-only file system, mkdir '/var/task/logs'",
    "code": "EROFS",
    "stack": [
        "Error: EROFS: read-only file system, mkdir '/var/task/logs'"
    ],
    "cause": {
        "errorType": "Error",
        "errorMessage": "EROFS: read-only file system, mkdir '/var/task/logs'",
        "code": "EROFS",
        "stack": [
            "Error: EROFS: read-only file system, mkdir '/var/task/logs'"
        ],
        "errno": -30,
        "syscall": "mkdir",
        "path": "/var/task/logs"
    },
    "isOperational": true,
    "errno": -30,
    "syscall": "mkdir",
    "path": "/var/task/logs"
}

I am not able to figure out what could be the issue and why is it occurring only on alternate requests and not every request.How do I go on about it? Any help would be appreciated.

John Rotenstein
  • 203,710
  • 21
  • 304
  • 382
dave Miller
  • 254
  • 1
  • 5
  • 12
  • Anyone? :( Can anyone please help me? – dave Miller Sep 05 '19 at 12:04
  • Possible duplicate of [Getting error AWS Lambda : EROFS: read-only file system, open '/var/task/assets/docs.zip'](https://stackoverflow.com/questions/53810516/getting-error-aws-lambda-erofs-read-only-file-system-open-var-task-assets) – Alexandr Lihonosov Sep 05 '19 at 12:27

2 Answers2

0

Lambda dosen't allow you to write the space allocated to you.

Since, you are trying to create a directory may be to write logs, so its giving you the error.

To write application logs with lambda you can use AWS Cloudwatch log streaming.

https://www.npmjs.com/package/lambda-log

Atul Sharma
  • 7,910
  • 10
  • 36
  • 60
0

You can use /tmp directory for some temporary files, but there is also a limit 512Mb.

Check these links:

AWS Lambda Limits

Accessing Amazon CloudWatch Logs for AWS Lambda