Open ishihara1989 opened 3 years ago
I am having the same issue. I filed a ticket with AWS yesterday.
The solution for now is to downgrade all cdk packages to 1.110.0
.
OK, finally I found workaround. Adding
rest_api = self.chalice.sam_template.get_resource('RestAPI')
rest_api.add_property_override('EndpointConfiguration', {
'Type': 'EDGE'
})
to ChaliceApp.__init__
fixed the deploy issue..
H/t @skinny85 for the below information. There was a change in the AWS SAM specification that AWS CDK uses for automatically generating classes in the @aws-cdk/aws-sam module.
In this PR, the AWS::Serverless::Api
definition changed from:
"ResourceTypes": {
"AWS::Serverless::Api": {
"Properties": {
"EndpointConfiguration": {
"Required": false,
"PrimitiveType": "String",
"UpdateType": "Immutable"
},
to:
"ResourceTypes": {
"AWS::Serverless::Api": {
"Properties": {
"EndpointConfiguration": {
"Required": false,
"Type": "EndpointConfiguration",
"UpdateType": "Immutable"
},
AWS Chalice still generates the AWS SAM template using the older AWS CloudFormation specification that uses "PrimitiveType": "String"
:
"Resources": {
"RestAPI": {
"Type": "AWS::Serverless::Api",
"Properties": {
"EndpointConfiguration": "EDGE",
It seems to break when AWS CDK cloudformation_include.CfnInclude
parses the AWS SAM template because of the mismatch in AWS CloudFormation specification.
Perhaps AWS Chalice should be updated to produce the new AWS CloudFormation specification to avoid the need in the escape hatch.
This is a little worrying.
The CDK takes the SAM spec from the GoFormation project. Apparently this change to the SAM spec was done in https://github.com/awslabs/goformation/pull/376.
However, this would imply that the SAM folks made breaking change in their spec, which I hope is unlikely. Perhaps the correct type for that property should be a union between a string, and the EndpointConfiguration
property type...?
Hmm, the public SAM docs state:
EndpointConfiguration The endpoint type of a REST API.
Type: EndpointConfiguration
Required: No
AWS CloudFormation compatibility: This property is similar to the EndpointConfiguration property of an AWS::ApiGateway::RestApi resource. The nested configuration properties are named differently.
So maybe this really was a breaking change in SAM....?
Confirmed with the SAM folks that this is actually incorrect in the docs, and that string is still allowed there.
I will patch this in the CDK.
I followed the steps in official CDK tutorials but couldn't make it work. Cloudformation detected some type errors, but according to AWS documents,
AWS::ApiGateway::RestApi
doesn't have propertyTypes
. I don't know if this is because of my setups. I suspect some Cloudformation APIs have changed. Are there any workaround for this?Steps to reproduce
Version information: