我无法通过 Api Gataway 访问 S3。我订阅了以下模板:
/s3:
get:
produces:
- application/json
parameters:
- name: "key"
in: "query"
required: false
type: "string"
responses:
"200":
description: 200 response
x-amazon-apigateway-integration:
credentials:
Fn::GetAtt:
- ApiRole
- Arn
requestParameters:
- integration.request.path.key: "method.request.querystring.key"
uri: "arn:aws:apigateway:eu-west-1:s3:path/{key}"
consumes:
- application/json
produces:
- application/json
responses:
default:
statusCode: '200'
passthroughBehavior: when_no_match
httpMethod: GET
type: aws
但是当我检查工作时:
我收到一个错误:
Execution failed due to configuration error: Illegal character in path at index 35: https://s3-eu-west-1.amazonaws.com/{key}
Thu Dec 13 22:46:03 UTC 2018 : Method completed with status: 500
集成请求中可能没有覆盖我的查询字符串。但我不知道如何正确地做到这一点。
最佳答案
我不确定这是否可行,但您可能希望将该 {s3} pathParam 更改为 {proxy+},从而将该 pathParam 转换为/'*' 通配符。
见 https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-method-settings-method-request.html
祝你好运!
关于amazon-web-services - 由于配置错误 : Illegal character in path in Api Gataway,执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53771246/