I’ve been working on a serverless project since the beginning of last week - since the weekend (and a system reboot) my serverless project is now giving me Stack with id [stack-name] does not exist for just about all operations. The stack ID in question is an existing CloudFormation stack that definitely exists in the target account.
I’ve googled high & low for an answer to this with no success.
Occasionally in my attempts to get this working again I’ve been given the AWS provider credentials not found. error but I don’t know if that’s because I had screwy config at the time.
I’m using AWS with a primary account for which I have access keys with a secondary account that has a role which I am assuming for the deployment.
Normal AWS CLI functionality works in that I can aws --profile ${SECOND_ACCOUNT} cloudformation describe-stacks --stack-name ${STACK_NAME} and see the normal output.
Serverless Version: 1.20.1 Node Version: 6.11.0 OS: Bash (Ubuntu) on Windows
As said - this setup was working last week, though it took a bit of convincing, turns out I had a typo in my .aws/config file which I fixed at the time. I don’t know if during the process of trying to fix this I exported some environment variables that fixed the issue.
Things I’ve tried:
Exporting AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables
Exporting an AWS_PROFILE environment variable
Setting credentials using serverless config credentials
The command I’m running is serverless info -s dev --aws-profile ${SECOND_ACCOUNT}.
What am I missing? 5 internets to the person who can spot my fail.
CloudFormation is region specific so if you have moved from one region to another while you were trying different credential methods, will account for the issue.
You can check what region the stack is in, using the console, then set the region explicitly using -r (edit: as a test, then set it permanently, probably using ~/aws/config).
My default region is eu-west-1 and hasn’t changed.
I have the region configured in my ~/.aws/config file but I also tried specifying it on the CLI with the --region option.
I’ve managed to get it to work using aws sts assume-role and proving the AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN variables on the CLI but this is not exactly ideal.
Hello from 2021.
I am very new to Serverless framework.
Trying to execute serverless info on an existing infrastructure and get Stack with id xxxxx does not exist.
The stack does exist, aws --region ap-southeast-2 cloudformation describe-stacks --stack-name xxxxx is showing it!
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 16.1.0
Framework Version: 1.83.3 (local)
Plugin Version: 3.8.4
SDK Version: 2.3.2
Components Version: 2.34.9
I have probably figured this out. In my case the real error was another one (it was related with the missing region) but it was showing it as “Stack with id does not exist”.
So, you should try to temporarily disable the offending rows with ${cf:... and try to print the stack output to check if it works without these rows.