zappa的显示在AWS Lambda上显示错误

时间:2019-11-09 03:27:03

标签: aws-lambda spacy zappa

我的API使用Zappa与AWS Lambda完美配合。但是我需要代码可以运行。当我安装spacy == 2.0.13并更新zappa dev时,api停止工作。它给出502错误。请帮助我。我已经将内存大小增加到3008。

以下内容作为响应正文返回:

{'message': 'An uncaught exception happened while servicing this request. You can investigate this with the zappa tail command.', 'traceback': ['Traceback (most recent call last):\\n', '  File \"/var/task/handler.py\", line 531, in handler\\n    with Response.from_app(self.wsgi_app, environ) as response:\\n', '  File \"/var/task/werkzeug/wrappers/base_response.py\", line 287, in from_app\\n    return cls(*_run_wsgi_app(app, environ, buffered))\\n', '  File \"/var/task/werkzeug/wrappers/base_response.py\", line 26, in _run_wsgi_app\\n    return _run_wsgi_app(*args)\\n', '  File \"/var/task/werkzeug/test.py\", line 1119, in run_wsgi_app\\n    app_rv = app(environ, start_response)\\n', \"TypeError: 'NoneType' object is not callable\\n\"]}

Zappa尾巴上的日志:

File "/var/task/handler.py", line 602, in lambda_handler
 return LambdaHandler.lambda_handler(event, context)
 File "/var/task/handler.py", line 245, in lambda_handler
 handler = cls()
 File "/var/task/handler.py", line 102, in __init__
 self.load_remote_project_archive(project_archive_path)
 File "/var/task/handler.py", line 174, in load_remote_project_archive
 t.extractall(project_folder)
 File "/var/lang/lib/python3.6/tarfile.py", line 2010, in extractall
 numeric_owner=numeric_owner)
 File "/var/lang/lib/python3.6/tarfile.py", line 2052, in extract
 numeric_owner=numeric_owner)
 File "/var/lang/lib/python3.6/tarfile.py", line 2122, in _extract_member
 self.makefile(tarinfo, targetpath)
 File "/var/lang/lib/python3.6/tarfile.py", line 2171, in makefile
 copyfileobj(source, target, tarinfo.size, ReadError, bufsize)
 File "/var/lang/lib/python3.6/tarfile.py", line 252, in copyfileobj
 dst.write(buf)

从Cloudwatch控制台登录:

[Errno 28] No space left on device: OSError
Traceback (most recent call last):
 File "/var/task/handler.py", line 602, in lambda_handler
   return LambdaHandler.lambda_handler(event, context)
 File "/var/task/handler.py", line 245, in lambda_handler
   handler = cls()
 File "/var/task/handler.py", line 102, in __init__
   self.load_remote_project_archive(project_archive_path)
 File "/var/task/handler.py", line 174, in load_remote_project_archive
   t.extractall(project_folder)
 File "/var/lang/lib/python3.6/tarfile.py", line 2010, in extractall
   numeric_owner=numeric_owner)
 File "/var/lang/lib/python3.6/tarfile.py", line 2052, in extract
   numeric_owner=numeric_owner)
 File "/var/lang/lib/python3.6/tarfile.py", line 2122, in _extract_member
   self.makefile(tarinfo, targetpath)
 File "/var/lang/lib/python3.6/tarfile.py", line 2171, 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

1 个答案:

答案 0 :(得分:1)

您的错误是lambda函数上没有剩余空间。 SpaCy需要大量空间。因此,请遵循以下建议:

AWS Lambda No Space Left on Device error