Zappa deploy error deployed lambda failed.对“/”的 GET 请求产生了 502 响应代码
Zappa deploy error deployed lambda failed. A GET request to '/' yielded a 502 response code
我有 zappa 设置 json (zappa_settings.json
) 如下:
{
"dev": {
"app_function": "manage.app",
"aws_region": "ap-southeast-1",
"profile_name": "default",
"project_name": "digital-agency-ms",
"runtime": "python3.6",
"s3_bucket": "lambda.com",
"use_precompiled_packages": false
}
}
我运行我在本地的应用程序通过命令python manage.py run
这是我的 manage.py
:
"""Manage all command related to the micro-service."""
import unittest
import time
from app import app, manager
@manager.command
def run():
"""Run the app."""
app.run(host='0.0.0.0')
@app.route('/')
def index():
return "Hooray, you catch me !", 200
if __name__ == '__main__':
manager.run()
当我运行zappa deploy dev
它returns502
响应错误
错误显示:
错误:警告!已部署的 lambda 的状态检查失败。对“/”的 GET 请求产生了 502 响应代码。
这里是 zappa log
:
[DEBUG] 2020-01-26T06:04:49.799Z 977e2eda-d28a-4d6d-9242-8d5e58423154 Zappa Event: {}
[1580018889972] Instancing..
[1580018889975] /var/task/bcrypt/_bcrypt.abi3.so: invalid ELF header: ImportError
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 139, in __init__
self.app_module = importlib.import_module(self.settings.APP_MODULE)
File "/var/lang/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/var/task/manage.py", line 2, in <module>
import bcrypt
File "/var/task/bcrypt/__init__.py", line 25, in <module>
from bcrypt import _bcrypt
ImportError: /var/task/bcrypt/_bcrypt.abi3.so: invalid ELF header
[1580018929896] [DEBUG] 2020-01-26T06:08:49.896Z eb0e51bc-f741-46ff-b0e0-eddccef0b70e Zappa Event: {'time': '2020-01-26T06:08:38Z', 'detail-type': 'Scheduled Event', 'source': 'aws.events', 'account': '906846634189', 'region': 'ap-southeast-1', 'detail': {}, 'version': '0', 'resources': ['arn:aws:events:ap-southeast-1:906846634189:rule/27f04aa0e0e79b6dacd35f42d28e773800dd4-handler.keep_warm_callback'], 'id': 'bb44e9ee-095a-1ae0-6597-ebafee0f4186', 'kwargs': {}}
选项是什么 - 我错过了?
通过删除软件包
解决了这个问题
Flask-Bcrypt==0.7.1
来自 requirements.txt
重新安装软件包
我有 zappa 设置 json (zappa_settings.json
) 如下:
{
"dev": {
"app_function": "manage.app",
"aws_region": "ap-southeast-1",
"profile_name": "default",
"project_name": "digital-agency-ms",
"runtime": "python3.6",
"s3_bucket": "lambda.com",
"use_precompiled_packages": false
}
}
我运行我在本地的应用程序通过命令python manage.py run
这是我的 manage.py
:
"""Manage all command related to the micro-service."""
import unittest
import time
from app import app, manager
@manager.command
def run():
"""Run the app."""
app.run(host='0.0.0.0')
@app.route('/')
def index():
return "Hooray, you catch me !", 200
if __name__ == '__main__':
manager.run()
当我运行zappa deploy dev
它returns502
响应错误
错误显示:
错误:警告!已部署的 lambda 的状态检查失败。对“/”的 GET 请求产生了 502 响应代码。
这里是 zappa log
:
[DEBUG] 2020-01-26T06:04:49.799Z 977e2eda-d28a-4d6d-9242-8d5e58423154 Zappa Event: {}
[1580018889972] Instancing..
[1580018889975] /var/task/bcrypt/_bcrypt.abi3.so: invalid ELF header: ImportError
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 139, in __init__
self.app_module = importlib.import_module(self.settings.APP_MODULE)
File "/var/lang/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/var/task/manage.py", line 2, in <module>
import bcrypt
File "/var/task/bcrypt/__init__.py", line 25, in <module>
from bcrypt import _bcrypt
ImportError: /var/task/bcrypt/_bcrypt.abi3.so: invalid ELF header
[1580018929896] [DEBUG] 2020-01-26T06:08:49.896Z eb0e51bc-f741-46ff-b0e0-eddccef0b70e Zappa Event: {'time': '2020-01-26T06:08:38Z', 'detail-type': 'Scheduled Event', 'source': 'aws.events', 'account': '906846634189', 'region': 'ap-southeast-1', 'detail': {}, 'version': '0', 'resources': ['arn:aws:events:ap-southeast-1:906846634189:rule/27f04aa0e0e79b6dacd35f42d28e773800dd4-handler.keep_warm_callback'], 'id': 'bb44e9ee-095a-1ae0-6597-ebafee0f4186', 'kwargs': {}}
选项是什么 - 我错过了?
通过删除软件包
解决了这个问题 Flask-Bcrypt==0.7.1
来自 requirements.txt
重新安装软件包