aws-cdk: ‼️ NOTICE: aws-cdk CLI - "Cloud assembly schema version mismatch: Maximum schema version supported is 10.0.0, but found 11.0.0"

Please add your +1 👍 to let us know you have encountered this


Status: IN-PROGRESS

This is a bug in npm version 7 only (npm versions 6 and below work fine). See here for details: https://github.com/npm/cli/issues/3196

Overview:

After upgrading the CDK CLI package (aws-cdk) with npm version 7, running any CDK command in your CDK application fails with the error Cloud assembly schema version mismatch: Maximum schema version supported is 10.0.0, but found 11.0.0.

Complete Error Message

$ npx cdk ls
This CDK CLI is not compatible with the CDK library used by your application. Please upgrade the CLI to the latest version.
(Cloud assembly schema version mismatch: Maximum schema version supported is 10.0.0, but found 11.0.0)

Workaround:

Please remove the installed aws-cdk package, and then install it again:

$ npm uninstall -g aws-cdk
$ npm install -g aws-cdk

Original opening post

This CDK CLI is not compatible with the CDK library used by your application. Please upgrade the CLI to the latest version. (Cloud assembly schema version mismatch: Maximum schema version supported is 10.0.0, but found 11.0.0)

aws-cdk version 1.103.0 and 1.104.0 do not work. aws-cdk version 1.102.0 works fine

Reproduction Steps

Install aws-cdk 1.103.0 (or 1.104.0) pip install -r requirements.txt

cdk ls

What did you expect to happen?

List of stacks displayed

What actually happened?

"This CDK CLI is not compatible with the CDK library used by your application. Please upgrade the CLI to the latest version. (Cloud assembly schema version mismatch: Maximum schema version supported is 10.0.0, but found 11.0.0) "

Environment

  • CDK CLI Version : 1.104.0
  • Framework Version: 1.103.0 & 1.104.0
  • Node.js Version: v16.1.0
  • **OS : Mac Big Sur
  • Language (Version): Python 3.8.7

Other


This is 🐛 Bug Report

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 117
  • Comments: 52 (27 by maintainers)

Commits related to this issue

Most upvoted comments

This is because schema version 16.0.0 was introduced in CDK 1.139. CDKv2 does not support it yet as of 2.5.0.

Solutions:

  1. Use the 1.139 version of the CDK CLI instead of the latest v2.
  2. Downgrade your construct modules to 1.138
  3. Switch your construct modules to CDKv2.

Best I can recommend at this moment is trying:

$ npm uninstall -g aws-cdk
$ npm install -g aws-cdk

And seeing if that fixes it.

NPM left your install in an inconsistent state, and without being able to reproduce it it’s hard to say why.

Hello,

This is for future reference. I’m using CDK to deploy a pipeline stack in one account, then have that account (deploy-account) deploy on my behalf to other accounts (dev, prod, etc.)

I’m using TS for the CDK and have installed aws-cdk. node version: v16.14.0 npm version: v8.3.1cdk --version:v2.45.0`

Locally, everything was fine when doing cdk synth and cdk ls.

When I deploied to my deploy-account I was exevuting npx cdk synth as described in the docs. Then I was getting this error.

I tried:

npm uninstall -g aws-cdk
npm install -g aws-cdk

As suggested, but it didn’t worked for me.

What I did was:

# Updated the lib in my project
npm i -D aws-cdk@latest

# Reinstalling all packages
rm -fr node_modules package-lock.json cdk.out

# Reinstalling
npm i

After, when I redeployied it worked 🤷‍♂️

Hope it helps,

Best I can recommend at this moment is trying:

$ npm uninstall -g aws-cdk
$ npm install -g aws-cdk

And seeing if that fixes it.

NPM left your install in an inconsistent state, and without being able to reproduce it it’s hard to say why.

Thank you so much. I suffered a lot until follow your guide by uninstalling/installing.

Oh well I might know what it is. npx cdk happens to use whatever cdk it finds on the $PATH, if available.

What about:

$ npx --ignore-existing cdk ls

?

For me, the issue was that I had my dependencies using version: 1.124.0 but my devDependencies were using 1.117.0. Changing that fixed it for me.

From the logs here this looks like a genuine problem but I want to present another data point. Please review your config. Make sure you have not done something like what I had done in my project.

{
aws-cdk: "1.108.0",
"@aws-cdk/xyz": "^1.108.0"
...more cdk dependencies 
}

It’ll keep working perfectly fine until one day all the other dependencies are updated and aws-cdk is not compatible anymore and then you get this error.

Upgrading the package is not a solution. This will happen again.

Why does aws-cdk take a dependency on aws-cdk-lib for Cloud Assembly versions, but not declare that dependency in package.json as a peer dependency? If a version of aws-cdk only supports generating up to version 10, but the library needs version 11, then there should be a dependency relationship between the two.

I upgraded my node version to the latest - v20.10.0 (with npm 10.2.3). Then, reinstalled the aws-cdk. Updated package.json to use the latest aws-cdk and aws-cdk-lib. This fixed my issue.

> npm --version
10.2.3
> npx cdk --version
2.114.1 (build 02bbb1d)

I am using hte following dependencies:

  "devDependencies": {
    "@types/jest": "^29.5.5",
    "@types/node": "20.7.1",
    "jest": "^29.7.0",
    "ts-jest": "^29.1.1",
    "aws-cdk": "2.114.1",
    "ts-node": "^10.9.1",
    "typescript": "~5.2.2"
  },
  "dependencies": {
    "aws-cdk-lib": "2.114.1",
    "constructs": "10.3.0",
    "source-map-support": "^0.5.21"
  }

Have you tried a complete uninstall of aws-cdk and a re-install. That ‘fixed’ it for me

OK, I was playing with this all day, and, while I’m not sure why this happens, I have been able to consistently reproduce this error with NPM 7. It manifests itself with local installs the same as with global installs.

This is a sequence in a CDK project created with 1.105.0 that doesn’t have a package.json itself (for example, a Java/Python CDK project):

$ npm --version 
7.13.0

$ npm install aws-cdk@1.98.0 
added 201 packages, and audited 202 packages in 12s
found 0 vulnerabilities

$ npx cdk synth 
This CDK CLI is not compatible with the CDK library used by your application. Please upgrade the CLI to the latest version.
(Cloud assembly schema version mismatch: Maximum schema version supported is 9.0.0, but found 11.0.0)

$ npm install aws-cdk
added 8 packages, removed 36 packages, changed 14 packages, and audited 181 packages in 9s
found 0 vulnerabilities

$ npx cdk synth 
This CDK CLI is not compatible with the CDK library used by your application. Please upgrade the CLI to the latest version.
(Cloud assembly schema version mismatch: Maximum schema version supported is 9.0.0, but found 11.0.0)

$ cat node_modules/aws-cdk/node_modules/\@aws-cdk/cx-api/package.json 
{
  "name": "@aws-cdk/cx-api",
  "version": "1.98.0",
  ...

Clearly, the @aws-cdk/cx-api package stays at 1.98.0, instead of being updated to 1.105.0.