Stack with id does not exist? Stack definitely exists

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:

  1. Exporting AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables
  2. Exporting an AWS_PROFILE environment variable
  3. 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.

Edit: Command syntax

Updated to 1.21.0 - still not working.

Have you changed regions?

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.

Someone else raised the same problem and ended up having a bash script that does the trick (save anyone writing their own).

It’d be nice to see this in Serverless as it’s in similar tools like Sceptre using the iam_role configuration option.

Wow im having the exact same problem and it’s Nov 2020 now.

Below is my serverless.yml
service: sl-aws-api-01
app: sl-aws-api-01

frameworkVersion: ‘2’

provider:
name: aws
runtime: nodejs12.x

c:/> serverless [any command] keeps giving me the following…

Serverless Error ---------------------------------------

Stack with id cjs-dev does not exist

Your Environment Information ---------------------------
Operating System: win32
Node Version: 12.19.0
Framework Version: 2.11.1
Plugin Version: 4.1.2
SDK Version: 2.3.2
Components Version: 3.3.0

I’m having the same issue “Stack with id pending-date-service-dev does not exist” - May I know how did you resolve the issue?

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

How did you fix this?

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.