【发布时间】:2021-07-14 15:29:54
【问题描述】:
我正在尝试将 OpenApi 规范包含到我的 AWS::Serverless::Api DefinitionBody 中,如下所示:
MyApi:
Type: "AWS::Serverless::Api"
Properties:
StageName: 'dev'
Domain:
DomainName: 'mydomain.com'
CertificateArn: 'my-arn'
EndpointConfiguration: REGIONAL
Route53:
HostedZoneId: 'HOSTEDZONEID'
BasePath:
- /api
DefinitionBody:
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
Location: !Sub 'open-api.yml'
我使用Fn:Transform 来确保我的速记符号得到评估。我在open-api.yml 中使用了一些 AWS API Gateway 扩展,如下所示:
...
x-amazon-apigateway-integration:
uri: !Sub 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${FunctionName}/invocations'
responses:
default:
statusCode: "200"
passthroughBehavior: "when_no_templates"
httpMethod: "GET"
type: "aws_proxy"
当我运行sam deploy --debug 时出现以下错误:
转换 AWS::Include 失败:指定的 S3 对象的内容应该是有效的 Yaml/JSON
【问题讨论】:
标签: amazon-web-services yaml aws-sam aws-sam-cli