Sls deploy -s (dev / staging / prod) of AWS API Gateway is behaving unexpectedly

I understand that deployment of an AWS API Gateway service w/a stage flag will create a new CloudFormation stack w/its own endpoint. I understand why the folks at serverless believe this is preferable, and I’m on board. However a strange issue has arisen for me that I don’t see mentioned in your documentation:

I am running one command line command (sls deploy -s staging) to deploy a staging environment for my api. That single command results in:

  1. a new Cloudformation stack (expected & wanted behavior)
  2. a new API Gateway and endpoint w/‘staging’ stage (expected & wanted behavior)
  3. a ‘staging’ stage added to a previous API Gateway which was deployed w/‘dev’ stage (unexpected & unwanted behavior)

Any ideas why I’m getting this behavior? Also, is there any way that the newly created API Gateway (staging) name can be different from the (dev) name? Currently, they are both created w/the same API Gateway name.

1 Like

You’d probably need to post a MCVE, e.g. a serverless.yml and related source file(s) for anyone to debug this. Definitely seems odd.