缺少或无效"路径"功能中的属性" func_name"对于serverless.yml中的http事件

时间:2018-04-02 07:50:44

标签: amazon-web-services aws-lambda serverless-framework serverless

当我尝试部署到aws时,由于丢失或无效"路径"我发现错误财产

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

1 个答案:

答案 0 :(得分:3)

问题是这是一个糟糕的缩进。

# 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

来源: - https://forum.serverless.com/t/error-on-deploy-missing-or-invalid-path-property-in-function/2365 - https://serverless.com/framework/docs/providers/aws/guide/services#contents