我正在尝试使用serverless.com部署AWS API
当我这样做的时候:
sls --stage=dev --aws-profile=myprofile deploy --force我得到以下警告:
Configuration warning at 'functions.app.events[0]': unsupported function event我的serverless.yml包含以下部分:
functions:
app:
handler: src/index.handler
memorySize: 3008
events:
- httpApi:
method: '*'
path: '*'
authorizer:
name: serviceAuthorizer
scopes: # Optional
- user.id
- user.email事件部分有什么问题?
发布于 2020-10-27 07:36:04
问题确实是缩进。这个缩进很奇怪,所以我将在下面解释它。每个·都是一个空格:
functions:
··hello:
····handler: handler.hello
····events:
······- http:
··········path: /hello
··········method: get以下是一些建议:
- http:连字符后有一个空格。另一个提示:如果你发现你的文本编辑器正在自动格式化你的YAML文件,并用制表符或其他任何东西替换空格缩进,那么用以下设置将一个.editorconfig文件添加到根目录:
[*.yml]
indent_size = 2
indent_style = spaces发布于 2020-10-08 03:11:02
我也遇到过类似的问题。问题出在缩进上。尝试像这样修复它:
- httpApi:
method: '*'
path: '*'https://stackoverflow.com/questions/64074827
复制相似问题