【问题标题】:How can i use multiple path parameters from serverless framework我如何使用无服务器框架中的多个路径参数
【发布时间】:2020-01-27 08:58:03
【问题描述】:

我正在尝试部署我的无服务器应用程序。 但是有如下问题。

An error occurred: ApiGatewayResourceServicesServiceidVar - A sibling ({id}) of this resource already has a variable path part -- only one is allowed  

下面是我的代码。

updateApplication:
    handler: handler.updateApplication
    memorySize: 3008
    description: Update application
    timeout: 30
    events:
      - http:
          path: services/{serviceId}/applications/{applicationId}
          method: post
          cors: true
          authorizer: authorize
          request:
            parameters:
              paths:
                serviceId: true
                applicationId: true

任何意见或建议将不胜感激。提前谢谢你。

【问题讨论】:

标签: aws-lambda serverless


【解决方案1】:

无服务器框架似乎在抱怨您定义了两次路径参数。由于您已在-http: 正下方声明它,您可以删除request: parameters: paths: 块。

换句话说,试试这个:

updateApplication:
    handler: handler.updateApplication
    memorySize: 3008
    description: Update application
    timeout: 30
    events:
      - http:
          path: services/{serviceId}/applications/{applicationId}
          method: post
          cors: true
          authorizer: authorize

编码愉快! ?

【讨论】:

    猜你喜欢
    • 2020-04-25
    • 2016-12-30
    • 1970-01-01
    • 1970-01-01
    • 2020-09-08
    • 2020-03-11
    • 2020-10-11
    • 2022-07-19
    • 2020-10-21
    相关资源
    最近更新 更多