我尝试了快速入门示例并将它们全部部署到 aws 并且它们按预期工作。在我部署了我的项目后,它在到达端点时没有使用无用的消息:
{"message": "An uncaught exception happened while servicing this request. You can investigate this with the `zappa tail` command."
"traceback": "Traceback (most recent call last):
File \"/var/task/handler.py\", line 433, in handler
response=Response.from_app(self.wsgi_app, environ)
File \"/var/task/werkzeug/wrappers.py\", line 903, in from_app
return cls(*_run_wsgi_app(app, environ, buffered)
File \"/var/task/werkzeug/test.py\", line 884, in run_wsgi_app
app_rv = app(environ, start_response)",
"TypeError: 'NoneType' object is not callable"
]}
我检查了 AWS,一切都在那里,API 网关端点代理、lambda 函数和角色。
这是我的 zappa_settings 文件
{
"dev": {
"app_function": "main.app",
"aws_region": "eu-west-2",
"profile_name": "default",
"s3_bucket": "zappa-sodos"
}
}
这是 zappa 的尾巴(为了安全起见,一些数据被屏蔽了 xxx):
[1499618707646] [DEBUG] 2017-07-09T16:45:07.628Z f724d3cf-64c5-11e7-a037-b7a389f86726 Zappa Event: {'resource': '/{proxy+}', 'path': '/v1/article', 'httpMethod': 'POST', 'headers': {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'en-US,en;q=0.8,ar;q=0.6', 'cache-control': 'no-cache', 'CloudFront-Forwarded-Proto': 'https', 'CloudFront-Is-Desktop-Viewer': 'true', 'CloudFront-Is-Mobile-Viewer': 'false', 'CloudFront-Is-SmartTV-Viewer': 'false', 'CloudFront-Is-Tablet-Viewer': 'false', 'CloudFront-Viewer-Country': 'xx', 'content-type': 'application/x-www-form-urlencoded', 'Host': 'xxxxxxxx.execute-api.eu-west-2.amazonaws.com', 'origin': 'chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop', 'postman-token': 'xxxxx-636e-cb61-1da6-xxx', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36', 'Via': '2.0 xxxxx.cloudfront.net (CloudFront)', 'X-Amz-Cf-Id': 'xxxx-cUUCbAyGS1Xhy5fb_mdmt-xxxx==', 'X-Amzn-Trace-Id': 'Root=1-xxxx-xxxx', 'X-Forwarded-For': '195.142.175.59,
54.240.145.78', 'X-Forwarded-Port': '443', 'X-Forwarded-Proto': 'https'}, 'queryStringParameters': None, 'pathParameters': {'proxy': 'v1/article'}, 'stageVariables': None, 'requestContext': {'path': '/dev/v1/article', 'accountId': 'xxxx', 'resourceId': 'xxxx', 'stage': 'dev', 'requestId': 'f71da6ed-64c5-11e7-b70f-bbc6fe021ea4', 'identity': {'cognitoIdentityPoolId': None, 'accountId': None, 'cognitoIdentityId': None, 'caller': None, 'apiKey': '', 'sourceIp': '195.142.175.59', 'accessKey': None, 'cognitoAuthenticationType': None, 'cognitoAuthenticationProvider': None, 'userArn': None, 'userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36', 'user': None}, 'resourcePath': '/{proxy+}', 'httpMethod': 'POST', 'apiId': 'xxxxx'}, 'body': 'dXJsPWh0dHAlM0ElMkYlMkZhcmFiaTIxLmNvbSUyRnN0b3J5JTJGMTAxOTM4OCUyRiUyNUQ4JTI1QTMlMjVEOSUyNTg4JTI1RDklMjU4NC0lMjVEOCUyNUFEJTI1RDklMjU4MyUyNUQ5JTI1ODUtJTI1RDklMjU4MiUyNUQ4JTI1QjYlMjVEOCUyNUE3JTI1RDglMjVBNiUyNUQ5JTI1OEEtJTI1RDglMjVBOCUyNUQ4JTI1QjQlMjVEOCUyNUEzJTI1RDklMjU4Ni0lMjVEOSUyNTg1JTI1RDglMjVBRCUyNUQ4JTI1QTclMjVEOSUyNTg4JTI1RDklMjU4NCUyNUQ4JTI1QTktJTI1RDglMjVBNyUyNUQ5JTI1ODQlMjVEOCUyNUE3JTI1RDklMjU4NiUyNUQ5JTI1ODIlMjVEOSUyNTg0JTI1RDglMjVBNyUyNUQ4JTI1QTgtJTI1RDglMjVBNyUyNUQ5JTI1ODQlMjVEOSUyNTgxJTI1RDglMjVBNyUyNUQ4JTI1QjQlMjVEOSUyNTg0JTI1RDglMjVBOS0lMjVEOSUyNTgxJTI1RDklMjU4QS0lMjVEOCUyNUFBJTI1RDglMjVCMSUyNUQ5JTI1ODMlMjVEOSUyNThBJTI1RDglMjVBNw==',
'isBase64Encoded': True}
[1499618707646] 'NoneType' object is not callable
- 使用的 Zappa 版本:0.42.2
- 操作系统和 Python 版本:OS X El Capitan、Python 3.6.1
的输出pip freeze
:
aniso8601==1.2.1
argcomplete==1.8.2
base58==0.2.4
beautifulsoup4==4.6.0
boto3==1.4.4
botocore==1.5.40
certifi==2017.4.17
chardet==3.0.4 click==6.7
cssselect==1.0.1
docutils==0.13.1
durationpy==0.4
feedfinder2==0.0.4
feedparser==5.2.1
Flask==0.12.2
Flask-RESTful==0.3.6
future==0.16.0
futures==3.1.1
hjson==2.0.7
idna==2.5
itsdangerous==0.24
jieba3k==0.35.1
Jinja2==2.9.6
jmespath==0.9.3
kappa==0.6.0
lambda-packages==0.15.1
lxml==3.8.0
MarkupSafe==1.0
newspaper3k==0.2.2
nltk==3.2.4
olefile==0.44
Pillow==4.2.1
placebo==0.8.1
python-dateutil==2.6.0
python-slugify==1.2.4
pytz==2017.2
PyYAML==3.12
requests==2.18.1
requests-file==1.4.2
s3transfer==0.1.10
six==1.10.0
tldextract==2.1.0
toml==0.9.2
tqdm==4.14.0
troposphere==1.9.4
Unidecode==0.4.21
urllib3==1.21.1
Werkzeug==0.12
wsgi-request-logger==0.4.6
zappa==0.42.2
-e git+https://github.com/xxxx/bc_utilities.git@xxxx#egg=bc_utilities
有什么建议么?