Search code examples
python-3.xaws-lambdazappa

OSError: [Errno 28] No space left on device - AWS Lambda + Zappa


I have deployed an application on AWS lambda using Zappa. I get the error in zappa tail - OSError: No space left on device. The file size is large so I am using S3 as well. Below is my zappa settings.

{"dev": {
"app_function": "app.app",
"profile_name": "default",
"aws_region": "------",
"project_name": "----",
"runtime": "python3.6",
"s3_bucket": "------",
"timeout_seconds": 300,
"slim_handler": true
}
}

below is the stack trace:

[Errno 28] No space left on device: OSError
Traceback (most recent call last):
  File "/var/task/handler.py", line 609, in lambda_handler
  return LambdaHandler.lambda_handler(event, context)
  File "/var/task/handler.py", line 240, in lambda_handler
  handler = cls()
  File "/var/task/handler.py", line 97, in __init__
  self.load_remote_project_archive(project_archive_path)
  File "/var/task/handler.py", line 169, in load_remote_project_archive
  t.extractall(project_folder)
  File "/var/lang/lib/python3.6/tarfile.py", line 2012, in extractall
  numeric_owner=numeric_owner)
  File "/var/lang/lib/python3.6/tarfile.py", line 2054, in extract
  numeric_owner=numeric_owner)
  File "/var/lang/lib/python3.6/tarfile.py", line 2124, in _extract_member
  self.makefile(tarinfo, targetpath)
  File "/var/lang/lib/python3.6/tarfile.py", line 2173, in makefile
  copyfileobj(source, target, tarinfo.size, ReadError, bufsize)
  File "/var/lang/lib/python3.6/tarfile.py", line 252, in copyfileobj
  dst.write(buf)
OSError: [Errno 28] No space left on device

Any suggestions?


Solution

  • It was a memory issue. Cleaning up the code and the virtualenv solved the problem. Removed extra libraries which were not required to reduce the space.