Skip to content

fix(toolkit-lib): refactor ignores a custom toolkit stack name - #1791

Merged
aws-cdk-automation merged 1 commit into
mainfrom
mrgrain/fix/toolkit-lib/refactor-custom-toolkit-stack-name
Jul 31, 2026
Merged

fix(toolkit-lib): refactor ignores a custom toolkit stack name#1791
aws-cdk-automation merged 1 commit into
mainfrom
mrgrain/fix/toolkit-lib/refactor-custom-toolkit-stack-name

Conversation

@mrgrain

@mrgrain mrgrain commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Fixes #1790

cdk refactor failed with Template too large to refactor ("cdk bootstrap" is required) in environments bootstrapped under a custom toolkit stack name, even though they were bootstrapped correctly. Refactoring a template larger than 50KiB has to upload it to the bootstrap staging bucket, and that lookup always searched for CDKToolkit, ignoring both --toolkit-stack-name and toolkitStackName in cdk.json. The same blind spot silently disabled the bootstrap version check, so a bootstrap stack too old to refactor was only caught later, inside CloudFormation.

cdk refactor now also accepts --toolkit-stack-name, which was rejected here while deploy, import and bootstrap all accept it.

Both of these now work as you'd expect: point cdk refactor at a custom-named bootstrap stack, by flag or config, and large templates are staged in the right bucket.

Checklist

  • This change contains a major version upgrade for a dependency and I confirm all breaking changes are addressed
    • Release notes for the new version:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@aws-cdk-automation
aws-cdk-automation requested a review from a team July 31, 2026 13:19
Comment thread packages/aws-cdk/lib/cli/user-input.ts
Comment thread packages/@aws-cdk-testing/cli-integ/resources/cdk-apps/app/app.js Outdated
@mrgrain
mrgrain force-pushed the mrgrain/fix/toolkit-lib/refactor-custom-toolkit-stack-name branch from eb2d397 to 4980426 Compare July 31, 2026 15:16
When a refactor has to upload templates larger than 50KiB to the
bootstrap staging bucket, it looked up the bootstrap stack under the
default `CDKToolkit` name, so any environment bootstrapped under a
custom name failed with "Template too large to refactor". The bootstrap
version check had the same problem and silently skipped itself.

Thread the toolkit stack name through the refactor action, and accept
`--toolkit-stack-name` on `cdk refactor`.

Fixes #1790
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: does not respect custom toolkit stack name when uploading large templates

4 participants