首页 > 解决方案 > serverless.yml 如何使用多个路径参数?

问题描述

我想配置这个模式的 url:team/{tid}/player/{pid}

我试图做到这一点:

  get_player_info:
    handler: handlers.get_player_info
    timeout: 30
    warmup: true
    events:
      - http:
          path: team/{tid}/player/{pid}
          request:
            parameters:
              paths:
                tid: true
                pid: true
          method: get
          cors: true
          authorizer: ${self:provider.custom.authorizer}

但是我在尝试部署时遇到错误:

ApiGatewayResourceAnalysisAidVar - A sibling ({uid}) of this resource already has a variable path part -- only one is allowed

当使用一个路径参数时,一切正常。

删除request零件(应该对其进行验证)时,我仍然遇到相同的错误。

标签: aws-api-gatewayserverless-framework

解决方案


推荐阅读