sgr*_*umo 6 amazon-web-services aws-lambda
总的来说,我对 Lambda 和 AWS 尤其陌生。我正在尝试使用 Lambda 设置一个简单的 REST API 服务。我使用 CloudFormat 和 CodePipeline 来创建一个简单的 Express 应用程序。我试图弄清楚为什么在部署阶段,在ExecuteChangeSet期间我有这个错误:
Errors found during import: Unable to create resource at path '/stations/{stationId}/allowedUsers': A sibling ({id}) of this resource already has a variable path part -- only one is allowed Unable to create resource at path '/stations/{stationId}/allowedUsers/{userId}': A sibling ({id}) of this resource already has a variable path part -- only one is allowed
这是我在template.yml 中的内容
Events:
AllowedUsers:
Type: Api
Properties:
Path: /stations/{stationId}/allowedUsers
Method: get
AddAllowedUsers:
Type: Api
Properties:
Path: /stations/{stationId}/allowedUsers
Method: post
DeleteAllowedUsers:
Type: Api
Properties:
Path: /stations/{stationId}/allowedUsers/{userId}
Method: delete
GetAllowedUser:
Type: Api
Properties:
Path: /stations/{stationId}/allowedUsers/{userId}
Method: get
Run Code Online (Sandbox Code Playgroud)
我搜索了一些这个错误,但我不知道如何解决它。
Owe*_*wen 13
对我来说,这个问题与 Bryan 提到的 GitHub 问题中描述的不同。
我使用了两个不同的参数名称。完成重构并使用单个 ID 名称解决了该问题。
例子:
DeleteAllowedUsers:
Type: Api
Properties:
Path: /stations/{stationId}/allowedUsers/{id}
Method: delete
GetAllowedUser:
Type: Api
Properties:
Path: /stations/{stationId}/allowedUsers/{userId}
Method: get
Run Code Online (Sandbox Code Playgroud)
小智 6
在使用 serverless (和 serverless.yaml )配置 AWS gatewayApi 时更新变量路径时,您可能会遇到此问题,以下是解决方法:
| 归档时间: |
|
| 查看次数: |
1352 次 |
| 最近记录: |