Open jsunico opened 2 weeks ago
Hey @jsunico , thanks for reaching out. From the initial error check, it looks like the stack name given by you, is the issue, not the code. https://github.com/aws/aws-cdk/blob/bf3764fe6046799a2a6e074b39b9a5f4474c603c/packages/aws-cdk-lib/core/lib/stack.ts#L455
Found somewhat similar issue in the past - https://github.com/aws/aws-cdk/issues/23098 It would be more helpful if you could share the minimal repro code with the stack name you are using.
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
Hi @khushail, so I tried to reproduce it in a new project here: https://github.com/jsunico/aws-cdk-repro-cross-region-action-in-pipeline
I started off with just a single stack which is generated by cdk init
. I didn't experience the issue. I then switch to nested stack to align it with our project setup and was able to reproduce the issue.
This is the error you'll get when running npx cdk synth
Error: Stack name must match the regular expression: /^[A-Za-z][A-Za-z0-9-]*$/, got '${Token[TOKEN.21]}-support-service'
at new Stack (github-issues/pipeline-cross-region/node_modules/aws-cdk-lib/core/lib/stack.js:1:4798)
at new CrossRegionSupportStack (github-issues/pipeline-cross-region/node_modules/aws-cdk-lib/aws-codepipeline/lib/private/cross-region-support-stack.js:1:1984)
at Pipeline.createSupportResourcesForRegion (github-issues/pipeline-cross-region/node_modules/aws-cdk-lib/aws-codepipeline/lib/pipeline.js:1:14004)
at Pipeline.obtainCrossRegionSupportFor (github-issues/pipeline-cross-region/node_modules/aws-cdk-lib/aws-codepipeline/lib/pipeline.js:1:12840)
at Pipeline.ensureReplicationResourcesExistFor (github-issues/pipeline-cross-region/node_modules/aws-cdk-lib/aws-codepipeline/lib/pipeline.js:1:12360)
at Pipeline._attachActionToPipeline (github-issues/pipeline-cross-region/node_modules/aws-cdk-lib/aws-codepipeline/lib/pipeline.js:1:11358)
at Stage.attachActionToPipeline (github-issues/pipeline-cross-region/node_modules/aws-cdk-lib/aws-codepipeline/lib/private/stage.js:1:3313)
at Stage.addAction (github-issues/pipeline-cross-region/node_modules/aws-cdk-lib/aws-codepipeline/lib/private/stage.js:1:1928)
at new Stage (github-issues/pipeline-cross-region/node_modules/aws-cdk-lib/aws-codepipeline/lib/private/stage.js:1:888)
at Pipeline.addStage (github-issues/pipeline-cross-region/node_modules/aws-cdk-lib/aws-codepipeline/lib/pipeline.js:1:9264)
From the error above, it seems that the method below is not getting the correct pipelineStackName. In a single stack setup, it can successfully get the stack name but in a nested stack setup it is returning ${Token[TOKEN.21]}
.
Hi @jsunico , thanks for sharing the repro code and your investigation.
I found various related issues around this one ,sharing few of those - https://github.com/aws/aws-cdk/issues/6190 https://github.com/aws/aws-cdk/issues/27746 https://github.com/aws/aws-cdk/issues/5029 https://github.com/aws/aws-cdk/pull/22223 PR - https://github.com/aws/aws-cdk/pull/4745 , https://github.com/aws/aws-cdk/pull/6419
Although relative PRs have been merged but this CrossAccountRegion deployment is causing the issue. I faced the sImilar issue when tried to deploy the code shared by you. I checked all the Pipeline related guidelines, still getting this issue -
This surely seems a bug.
I am marking it as P1, requesting further action/inputs from the core team.
Describe the Bug
I have a State Machine from another region that is being imported to CDK via StateMachine.fromStateMachineArn. When this state machine is added as cross-region StepFunctionInvokeAction to the pipeline an error is thrown.
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
Cross-region action can be added to the pipeline.
Current Behavior
Reproduction Steps
Possible Solution
NA
Additional Information/Context
No response
CDK CLI Version
2.158.0
Framework Version
No response
Node.js Version
18.20.4
OS
WSL Ubuntu 20
Language
TypeScript
Language Version
~4.6.4
Other information
No response