我有一个用于AWS的python无服务器项目。但是每当我运行sls deploy时,都会遇到这个错误,我在我的.serverless中注意到它实际上并没有压缩文件,只生成.json文件。在
An error occurred: ParserLambdaFunction - Uploaded file must be a non-empty zip.
我的yml是这样的:
service: my-service
provider:
name: aws
runtime: python3.6
package:
individually: True
plugins:
- serverless-package-python-functions
- serverless-python-requirements
custom:
pkgPyFuncs: # plugin configuration
buildDir: _build
functions:
parser:
handler: handler.parser
package:
include:
artifact: ${self:custom.pkgPyFuncs.buildDir}/my-service-dev-parser.zip
events:
- http:
cors: true
integration: LAMBDA
passThrough: WHEN_NO_MATCH
path: /
method: post
request:
parameters:
querystring:
application/json: "$input.path('$.body')"
url: true
- cloudwatchLog: '/aws/lambda/pythonParser'
我的包.json看起来像这样:
^{pr2}$我的文件夹结构如下:
-my-service
--.serverless
--_pycache_
--_build
--node_modules
--standford-new-2017-06-09
--.gitignore
--handler.py
--package.json
--serverless.yml
--tsconfig.json
--typings.json
一方面,您可以简单地删除
include
或使用就像上面说的-把你的代码放在你的dir的子文件夹里。在
相关问题 更多 >
编程相关推荐