Skip to content

Commit

Permalink
fix(cli): downgrade bootstrap stack error message needs a hint for ne…
Browse files Browse the repository at this point in the history
…w-style synthesis (aws#16237)

Fix to the bootstrap error message on the version comparison to provide to peek at solution so as to warn users about new style stack synthesis not being enabled automatically in the cdk.json as the potential root cause

Fixes aws#16009

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
AnuragMohapatra authored and TikiTDO committed Feb 21, 2022
1 parent 02c8dfe commit 6e141bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class BootstrapStack {

const newVersion = bootstrapVersionFromTemplate(template);
if (this.currentToolkitInfo.found && newVersion < this.currentToolkitInfo.version && !options.force) {
throw new Error(`Not downgrading existing bootstrap stack from version '${this.currentToolkitInfo.version}' to version '${newVersion}'. Use --force to force.`);
throw new Error(`Not downgrading existing bootstrap stack from version '${this.currentToolkitInfo.version}' to version '${newVersion}'. Use --force to force or set the '@aws-cdk/core:newStyleStackSynthesis' feature flag in cdk.json to use the latest bootstrap version.`);
}

const outdir = await fs.mkdtemp(path.join(os.tmpdir(), 'cdk-bootstrap'));
Expand Down Expand Up @@ -114,4 +114,4 @@ export function bootstrapVersionFromTemplate(template: any): number {
}
}
return 0;
}
}

0 comments on commit 6e141bf

Please sign in to comment.