serverless.yml 中的 http 事件的函数 "func_name" 中缺少或无效 "path" 属性

Missing or invalid "path" property in function "func_name" for http event in serverless.yml

当我尝试部署到 aws 时,由于 缺失或无效 "path" 属性 出现错误。

serverless deploy -v
#OR
serverless run --watch
# serveless file

service:
  name: aws-nodejs-ecma-script

# Add the serverless-webpack plugin
plugins:
  - serverless-webpack

provider:
  name: aws
  runtime: nodejs6.10

functions:
  events_get:
    handler: get.handler
    events:
      - http:
        method: get
        path: test

嗯,问题是缩进不好。

# solution one
functions:
  events_get:
    handler: get.handler
    events:
      - http:
          method: get
          path: test

# solution two
functions:
  events_get:
    handler: get.handler
    events:
      - http: get test

来源: