我希望创建一个 api-gateway httpapi,把 $default 路由全发给一个lambda函数。
SAM配置:
...
Events:
ExplicitApi: # warning: creates a public endpoint
Type: HttpApi
Properties:
ApiId: !Ref HttpApi
# route all path to one endpoint.
Path: $default
Method: ANY
TimeoutInMillis: 15000
# https://docs.aws.amazon.com/zh_cn/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
PayloadFormatVersion: "2.0"
RouteSettings:
ThrottlingBurstLimit: 50
Cloudfomation 报错
Resource handler returned message: "Warnings found during import: Parse issue: attribute paths. Resource $default should start with / (Service: AmazonApiGatewayV2; Status Code: 400; Error Code: BadRequestException; Request ID: ce4209a2-49b6-445a-b1c2-6120eff65ace; Proxy: null) (Service: null; Status Code: 404; Error Code: BadRequestException; Request ID: null; Proxy: null)" (RequestToken: 100b7e44-826d-cca7-3b2b-144ce77f3771, HandlerErrorCode: GeneralServiceException)
原因是SAM还不支持这种 '$default' 方式。bug: https://github.com/aws/serverless-application-model/issues/2481#issuecomment-1233074041
标签:apigateway,Code,default,aws,null,lambda From: https://www.cnblogs.com/jneeee/p/16950259.html