This error occurs when the Serverless Framework (or an integrated tool like AWS SAM) cannot resolve a CloudFormation stack name. Here’s how to fix it:
service
and stage
Are Properly ConfiguredAdd stage
under the provider
in serverless.yml
. The stack name is auto-generated as ${service}-${stage}
:
service: py-events
provider:
name: aws
stage: dev # 👈 Required for stack name resolution
region: us-east-1 # Optional but recommended
Override the default stack name in serverless.yml
:
provider:
name: aws
stackName: py-events-${sls:stage} # e.g., "py-events-dev"
If you’re not using AWS SAM:
template.yaml
(SAM’s config file).samconfig.toml
(if present).The Serverless Framework will then use its own stack naming logic.
If you are using SAM (e.g., for other resources):
samconfig.toml
in your project root:
version = 0.1
[default.deploy.parameters]
stack_name = "py-events-dev"
region = "us-east-1"
sls
:
sam deploy --config-file samconfig.toml
template.yaml
or samconfig.toml
file was added recently, the Serverless Framework may default to SAM’s deployment logic, which requires explicit stack names.serverless.yml
has service
, stage
, and region
:
service: py-events
provider:
name: aws
stage: dev
region: us-east-1
template.yaml
, samconfig.toml
).sls deploy --stage dev
This resolves the stack name ambiguity by forcing the Serverless Framework to use its internal naming convention.
After applying the solution, check the AWS CloudFormation console for a stack.
References: