Home > Mobile >  AWS Lambda function returns "errorMessage": "[Errno 30] Read-only file system: '
AWS Lambda function returns "errorMessage": "[Errno 30] Read-only file system: '

Time:08-18

I get the following error

{
  "errorMessage": "[Errno 30] Read-only file system: '/home/sbx_user1051'",
  "errorType": "OSError",
  "stackTrace": [
    "  File \"/var/lang/lib/python3.8/imp.py\", line 234, in load_module\n    return load_source(name, filename, file)\n",
    "  File \"/var/lang/lib/python3.8/imp.py\", line 171, in load_source\n    module = _load(spec)\n",
    "  File \"<frozen importlib._bootstrap>\", line 702, in _load\n",
    "  File \"<frozen importlib._bootstrap>\", line 671, in _load_unlocked\n",
    "  File \"<frozen importlib._bootstrap_external>\", line 843, in exec_module\n",
    "  File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n",
    "  File \"/var/task/app.py\", line 3, in <module>\n    nltk.download('stopwords')\n",
    "  File \"/var/task/nltk/downloader.py\", line 777, in download\n    for msg in self.incr_download(info_or_id, download_dir, force):\n",
    "  File \"/var/task/nltk/downloader.py\", line 642, in incr_download\n    yield from self._download_package(info, download_dir, force)\n",
    "  File \"/var/task/nltk/downloader.py\", line 699, in _download_package\n    os.makedirs(download_dir)\n",
    "  File \"/var/lang/lib/python3.8/os.py\", line 213, in makedirs\n    makedirs(head, exist_ok=exist_ok)\n",
    "  File \"/var/lang/lib/python3.8/os.py\", line 223, in makedirs\n    mkdir(name, mode)\n"
  ]
}

when testing my lambda function. I don't understand what this error is telling me to do about the docker image I am using, if that even is the correct route to explore. What should I do

CodePudding user response:

AWS Lambda is not a generic docker runner. The docker containers you deploy to Lambda have to comply with the AWS Lambda runtime environment.

The docker image you are using is trying to write to the path /home/sbx_user1051 apparently. On AWS Lambda the file system is always read-only except for the /tmp path. You will have to modify the code running in the docker image to prevent it from writing anywhere else but /tmp/.

  • Related