API Gateway Stages Deployment only gets updated when Swagger is updated
Ref: Deploy DotNetCore Api Gateway and Functions using SAM
Hi
I have updated my template.yaml file to use AWS::Serverless::Api and AWS::Serverless::Function to deploy API gateway and functions as part of DEV Stack. I am using API Gateway Stages for API versioning. A Stages and V1 stage is created when I deploy the Stack the first time. When I create a new build the Stages of the API Gateway does not get updated with a new deployment date. The change-set Action for the API Gateway and functions are Modify, The Stages is missing from the change-set.
I have notice the Stages of the API Gateway only gets updates when I update the swagger body. I was under the impression using AWS::Serverless::Api would update the Stage every time I deploy a new build is this correct?
Thank you
@brettstack do you have an ETA for fixing this? Cheers
@senseibaka can you describe your problem including template?
@brettstack I've observed that making a configuration change to the api doesn't result in a redeployment of the stage -- so the configuration change doesn't get reflected on that stage's endpoint. Manually deploying the stage after the fact resolves this.
For example, adding the following to my SAM/CFN template, does not result in a new AWS::ApiGateway::Deployment:
Globals:
Api:
MinimumCompressionSize: 0
Same issue for me, I created #914 to describe it. @brettstack there's a fully functional CF template on my issue if you're still looking for one. I'll copy a relevant snippet from my issue here as my question still stands:
Thinking about this in the context of my own custom transform I get why detecting the change in the ref is difficult in a transform, with it being a layer removed, but the UX confused me, my VTL changed so why didn't it deploy was my initial reaction.
I suspect this suggestion won't fly but I'm making it anyway: could you generate a new Deployment on every transform regardless of if the Api resource has changed or not? It feels like a safe choice, worst case it's a noop deployment, best case it means !Refs and !Subs and !Ifs within the transformed resource work intuitively.
#660 is a proposal to always deploy an API, which would help fix this issue. I agree that it might be nice to either always deploy new versions of the API or at least have an option to do so.
+1
@brettstack This caught us out recently when in our AWS::Serverless::Api resource we updated a parameter that was referenced by a !Sub in the x-amazon-apigateway-integration configuration - the api was not redeployed as expected and we had to update the parameter name to trigger the redeployment.
Not sure if this is related but we use an external API definition from S3 and when we update the location of DefinitionUri the API is updated but never deployed.
Our work around for the moment is to manually deploy the API via the CLI.
@carlnordenfelt It's somewhat related. We recommend using the DefinitionBody property of AWS::Serverless::Api with the AWS::Include transform instead of using DefinitionUri. This allows you to still keep your API definition in a separate file, but also take advantage of SAM features like automatic deployment generation. Here's an example along with an explanation of the benefits of using this pattern.
Closing this issue in favor of #660