question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cdk 2.1.0 synth, diff subcommands fail with "AssertDescription: CDK bootstrap stack version 6 required...". cdk 2.1.0 deploy subcommand succeeds.

See original GitHub issue

What is the problem?

cdk synth and cdk diff fail with “AssertDescription: CDK bootstrap stack version 6 required. Please run ‘cdk bootstrap’ with a recent version of the CDK CLI.” after the template checks SSM for version not 1-5. The actual version in SSM is 9.

cdk deploy succeeds.

After the successful cdk deploy, the synth and diff continue to fail.

Reproduction Steps

  1. Upgrade cdk 2.0.0 to 2.1.0
  2. run cdk bootstrap with appropriate credentials
  3. create a new folder and cd to it
  4. create a new cdk project with cdk init --language typescript
  5. cdk synth
  6. cdk diff
  7. cdk deploy

What did you expect to happen?

A clean synth with no errors displayed A clean diff with no errors displayed A clean deploy with no errors displayed

What actually happened?

for synth and diff

...
Rules:
  CheckBootstrapVersion:
    Assertions:
      - Assert:
          Fn::Not:
            - Fn::Contains:
                - - "1"
                  - "2"
                  - "3"
                  - "4"
                  - "5"
                - Ref: BootstrapVersion
        AssertDescription: CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI.

for deploy - a clean, error-free execution with a CFn template produced as expected.

CDK CLI Version

2.1.0

Framework Version

2.0.0

Node.js Version

16.10.0

OS

macOS Monterey (12.0.1)

Language

Typescript

Language Version

TypeScript 4.2.4

Other information

The bootstrap CDKToolkit stack looks as expected - all of the modern template trappings (the previous bootstrap was legacy). The value of the SSM parameter /cdk-bootstrap/hnb659fds/version is 9, as expected. The cdk-hnb659fds-deploy-role-<account>-<region> role has the appropriate ssm:GetParameter permission for …/cdk-bootstrap/hnb659fds/version. the cdk-hnb659fds-lookup-role-<account>-<region> role has ssm:Get* permission for *.

“old” cdk projects continue to function as expected with cdk synth etc.

Hoping you can deduce some bozo thing I must have overlooked or done. Thanks for whatever help you can provide.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:25 (9 by maintainers)

github_iconTop GitHub Comments

21reactions
forresthopkinsacommented, Mar 26, 2022

This is a pretty confusing thing to see when just starting with CDK. I get it now, but I would still consider it a UX bug.

16reactions
gaplo917commented, May 23, 2022

I just had a fresh install of aws-cdk 2.25.0 from cdk init app --language typescript confirmed problem still exist.

...
Rules:
  CheckBootstrapVersion:
    Assertions:
      - Assert:
          Fn::Not:
            - Fn::Contains:
                - - "1"
                  - "2"
                  - "3"
                  - "4"
                  - "5"
                - Ref: BootstrapVersion
        AssertDescription: CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI.

from @njlynch’s comment https://github.com/aws/aws-cdk/issues/17942#issuecomment-992295898

It will show up in the diff until it is deployed, and then will only show up if there’s a change, same as any other CloudFormation template element.

For the assertion issue also happen in cdk synth. So it is impossible to do the first deploy before I want to confirm what to be deployed by studying the output of cdk synth (synthesized CloudFormation template).

Workaround for typescript

For those who want to check the result before the first deploy, I suggest to temporarily add "@aws-cdk/core:newStyleStackSynthesis": false in your cdk.json

  "context": {
    "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true,
    "@aws-cdk/core:stackRelativeExports": true,
    "@aws-cdk/aws-rds:lowercaseDbIdentifier": true,
    "@aws-cdk/aws-lambda:recognizeVersionProps": true,
    "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true,
    "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
    "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
    "@aws-cdk/core:checkSecretUsage": true,
    "@aws-cdk/aws-iam:minimizePolicies": true,
+    "@aws-cdk/core:newStyleStackSynthesis": false,
    "@aws-cdk/core:target-partitions": [
      "aws",
      "aws-cn"
    ]
  }

After that, I can get the output image

Read more comments on GitHub >

github_iconTop Results From Across the Web

AssertDescription: CDK bootstrap stack version 6 required
The error message is pretty clear as to what to do: This CDK deployment requires bootstrap stack version '6', found an older version....
Read more >
Troubleshooting common AWS CDK issues
You are deploying a stack that requires bootstrap resources, but are using an IAM role or account that lacks permission to write to...
Read more >
cdk 2.1.0 synth, diff subcommands fail with "AssertDescription
cdk synth and cdk diff fail with "AssertDescription: CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of...
Read more >
aws-cdk - npm
CDK Toolkit, the command line tool for CDK apps. Latest version: 2.54.0, last published: 6 days ago. Start using aws-cdk in your project...
Read more >
serverless-stack/aws-cdk NPM
If there are multiple stacks in your application, cdk synth will synthesize the cloud assembly to cdk.out . $ # Synthesize cloud assembly...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found