pipelines: Runtime error when a Stage has multiple Stacks with the same stack name #30449
Labels
@aws-cdk/pipelines
CDK Pipelines library
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
Describe the bug
When a stage contains multiple stacks with different IDs and different environments but the same name, cdk will throw a runtime error
RuntimeError: Error: Node with duplicate id: <stack_name>
. This error occurs during synth when the stage is added to a cdk pipeline.Expected Behavior
The cdk pipeline should be able to handle a stage with multiple stacks of the same name when the IDs and environments are different.
Current Behavior
Stacks with the same name but different IDs in the same stage cause a runtime error:
Reproduction Steps
This app has a cdk pipeline and a single stage with 2 stacks. The stack IDs and environments differ but the stack names are the same. Synth this app as-is and it will generate an error:
RuntimeError: Error: Node with duplicate id: my-test-stack
. Modify one of the stack names (like "my-test-stack-2") and it will synth without error.Possible Solution
No response
Additional Information/Context
The stack templates and manifest files are generated properly in the cdk.out folder under the pipeline assembly. Each stack has it's own asset and template files differentiated by stack ID and hash.
CDK CLI Version
2.144.0 (build 5fb15bc)
Framework Version
2.144.0
Node.js Version
18.17.0
OS
rocky linux 9
Language
Python
Language Version
3.9.18
Other information
No response
The text was updated successfully, but these errors were encountered: