serverless: Stack with id does not exist

This is a Bug Report

Description

Using AWS, recently I’ve started getting the error: Stack with id <STACK_NAME> does not exist. I am not sure why exactly it’s happening, but it might be triggered by deleting the stack in the AWS console. I think I have completely purged any reference to the stack from AWS.

The only way I found to recover from that is manually creating a stack with Cloudformation using the same name and redeploying on top of that using Serverless. How can we fix that more elegantly?

Additional Data

Serverless Framework Version: 1.15.0 I am using the serverless-aws-alias plugin, version 1.2.1

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

in my case, i just needed to specify the region as well

$ serverless remove --stage $STAGE --region $REGION

I fix the problem by reduce the length of stackName. As AWS required, as statckName will be used as a part of ‘roleName’ , and the role anme must have length less than or equal to 64

I’m seeing this as well, but I’m hitting too many buckets error on AWS. The terminal doesn’t send this information back.

Screen Shot 2020-05-05 at 3 40 39 PM

Screen Shot 2020-05-05 at 3 40 30 PM

Experiencing this error during the deployment. I finally figure it out why (at least on my side) that CloudFormation removes error stack before Serverless can get a hold of it to extract error reasons. So I went into AWS CloudFormation console and watch for error reason of the stack before it disappears.

Hello from 2019. sls remove is working as expected. Thank you

Indeed. What you can do as a quick fix is, to delete the alias stack (the foo-foo stack) in the AWS CF console. Then sls remove should work. I’ll give the alias removal feature very high priority now.

@HyperBrain How exactly do you remove the alias stack when using a CLI option to determine the stage (e.g. sls deploy --stage foo and using "stage": "${opt:stage}" in serverless.json)?

sls alias remove --alias foo --stage foo gives me:

Error: Cannot delete the stage alias. Did you intend to remove the service instead?

If you use the alias plugin, you have to remove the deployed aliases before removing the sls stack with sls alias remove --alias=XXXX. This removes any dependencies of the alias stacks to the sls base stack.

Currently the sls remove command is not hooked completely in the plugin. I will add that feature in the near future to the plugin, so that you can just do a sls remove and the plugin will remove its own resources automatically.

@pmuens For this to be done the sls remove command lifecycle has to be implemented with a detailed sublifecycle (as in package or deploy), so that the plugin (or any plugins) can hook the subfunctionality of the remove command.