When running sam validate on a tamplate containing a AWS::Serverless::Api resource with the Domain property configured it fails to recognize it upon validation, thorwing a property X not defined for resource of type Y error.
AWS::Serverless::Api resource. For example: ApiGateway:
Type: AWS::Serverless::Api
Properties:
Name: !Sub ${AWS::StackName}-gateway
StageName: test
EndpointConfiguration: REGIONAL
Domain:
BasePath:
- /test
CertificateArn: !Ref CustomDomainCertificateArn
DomainName: !Ref CustomDomainName
DefinitionBody:
Fn::Transform:
Name: AWS::Include
Parameters:
Location: swagger.yml
sam validateExecution throws the following error:
Error: [InvalidResourceException('ApiGateway', 'property Domain not defined for resource of type AWS::Serverless::Api')] ('ApiGateway', 'property Domain not defined for resource of type AWS::Serverless::Api')
A successfull template validation (Considering that all unrelated resources and properties have been configured correctly).
sam --version: 0.40.0This problem also happens to me.
Looks like sam build also doesn't work with the domain. Deploy works just fine though.
@dnorth98 how do you deploy without building first?
@dnorth98 how do you deploy without building first?
You only need to build if your function uses external modules. Mine doesn't (simple python functions that connect to DynamoDB and Kinesis). Create template with domain, sam deploy and voila. I'm guessing the deploy doesn't run through the same path as the build and validate (it is doing some kind of validate though).
For now, I'm going to have to rip out the domain stuff and add it using regular CFN a la https://github.com/awslabs/serverless-application-model/issues/40#issuecomment-411316776
@dnorth98 how do you deploy without building first?
building works, but validating and local start-api is not.
This is a new feature in SAM Translator 1.20.1, which will be supported with the next release.
@awood45 any idea when that will be released?
Why would they put it an all the docs if the feature isn't available yet!?
Why would they put it an all the docs if the feature isn't available yet!?
The feature is currently available in SAM not in SAM CLI.
Now it works with the latest SAM CLI version 0.41.0.
I think you can close this issue.
Yes, the "validate" passes now, but I'm not convinced that using the Domain property is a complete solution as described in the workaround in https://github.com/awslabs/serverless-application-model/issues/40. The API custom domain name is created, but apparently you can't create the Route53 hosted zone and record sets just using AWS::Serverless:Api Domain
This was released with aws-sam-cli 0.41.0 yesterday afternoon, closing.
Most helpful comment
This is a new feature in SAM Translator 1.20.1, which will be supported with the next release.