1

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
  • 241,921
  • 22
  • 380
  • 470
dave Miller
  • 304
  • 1
  • 6
  • 16
  • 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) – Oleksandr Lykhonosov Sep 05 '19 at 12:27

2 Answers2

1

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

24 MAR 2022 update:
AWS Lambda now allows you to configure ephemeral storage (/tmp) between 512 MB and 10,240 MB. You can continue to use up to 512 MB for free and are charged for the amount of storage you configure over the free limit for the duration of invokes.

Check these links:

AWS Lambda Limits
Accessing Amazon CloudWatch Logs for AWS Lambda
AWS Lambda Now Supports Up to 10 GB Ephemeral Storage

Oleksandr Lykhonosov
  • 1,138
  • 12
  • 25
  • Now the limit can be extended to 10Gb. – David Rhoderick Mar 01 '23 at 12:40
  • yeah, AWS Lambda now allows you to configure ephemeral storage (/tmp) between 512 MB and 10,240 MB. You can continue to use up to 512 MB for free and are charged for the amount of storage you configure over the free limit for the duration of invokes. https://aws.amazon.com/blogs/aws/aws-lambda-now-supports-up-to-10-gb-ephemeral-storage/ – Oleksandr Lykhonosov Mar 02 '23 at 13:03
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
  • 9,397
  • 10
  • 38
  • 65