cli: bootstrap stacks with non-standard name cause diff and import to fail on large templates #30936
Labels
bug
This issue is a bug.
cli
Issues related to the CDK CLI
closed-for-staleness
This issue was automatically closed because it hadn't received any attention in a while.
p1
package/tools
Related to AWS CDK Tools or CLI
response-requested
Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Describe the bug
When a synthesized template exceeds the maximum that can be passed inline to the API, the CLI attempts to look up the
ToolkitInfo
. If the stack name is non-default (e.g. created by a stack set) this lookup will fail, causing an error similar to:Expected Behavior
The
ToolkitInfo
is trying to create the S3 bucket URL. Normally this would be presented in the manifest asstackTemplateAssetObjectUrl
but it is ignored by diff and import.When using the default synthesizer it should be possible for the CLI to use the correct bucket name without needing to query the bootstrap stack outputs (
BucketDomainName
).Current Behavior
The stack name
CDKToolkit
is queried, which doesn't exist. The command then fails with an error.Reproduction Steps
CDKToolkit
.(note: deploy is fine, as it honours the
stackTemplateAssetObjectUrl
from the manifest)Possible Solution
The toolkit information should be accessible regardless of the stack name.
Either:
ToolkitInfo.lookup
. It's similar in spirit to theversionFromSsmParameter
lookup that falls back if the parameter doesn't exist.Additional Information/Context
The diff will fail to create a changeset but will continue and diff against the template, which is a significant degradation but not an outright failure. It is possible to work around this by specifying the
--cdk-toolkit-name
.Imports just fail hard. The workaround for this is to specify the
--cdk-toolkit-name
on the command line. This is quite tedious when doing this across multiple accounts, but it does allow the process to work.Since command line parameters can be overridden in the environment, it would be possible to create a parameter (
/cdk-toolkit/stack-name
or similar) with a known name in the stackset, and use a small script to assign the value of the parameter to the appropriate environment variable forcdk-toolkit-name
.CDK CLI Version
2.150.0
Framework Version
2.150.0
Node.js Version
20.x
OS
Darwin
Language
TypeScript
Language Version
5.1.x
Other information
makeBodyParameterAndUpload
callsmakeBodyParameter
with a fake stack object that has no URL, forcing the failover. This appears to be what triggers the eventual call toToolkitInfo.lookup()
and triggers the failure.The text was updated successfully, but these errors were encountered: