aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.63k stars 3.91k forks source link

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

Closed gerroldksky closed 2 years ago

gerroldksky commented 3 years ago

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

Other


This is :bug: Bug Report

rix0rrr commented 3 years ago

The error message says:

Please upgrade the CLI to the latest version.

Have you tried to do this? What commands have you run?

rix0rrr commented 3 years ago

Does not reproduce for me:

$ npx cdk@1.104.0 init -l=python
$ python3 -m venv .venv
$ source .venv/bin/activate.fish
(.venv)$ pip install -r requirements.txt
(.venv)$ npx cdk@1.104.0 ls
PythonStack
hoegertn commented 3 years ago

Very weird as I saw the error too.

I tried to reproduce using your commands and I observe the following

(.venv) [hoegertn@MacMini ws-0ec1ae (main)]$ npx cdk@1.104.0 ls
Ws0Ec1AeStack
(.venv) [hoegertn@MacMini ws-0ec1ae (main)]$ 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)
(.venv) [hoegertn@MacMini ws-0ec1ae (main)]$ npx cdk --version
1.104.0 (build 44d3383)
(.venv) [hoegertn@MacMini ws-0ec1ae (main)]$

So it works using the fixed version but not without despite it being the same version according to --version

rix0rrr commented 3 years ago

Huh!

rix0rrr commented 3 years ago

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

?

hoegertn commented 3 years ago
(.venv) [hoegertn@MacMini ws-9fbbac (main)]$ npx cdk@1.104.0 ls
Ws9FbbacStack
(.venv) [hoegertn@MacMini ws-9fbbac (main)]$ 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)
(.venv) [hoegertn@MacMini ws-9fbbac (main)]$ npx --ignore-existing cdk ls
npx: the --ignore-existing argument has been removed.
See `npm help exec` for more information
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)
(.venv) [hoegertn@MacMini ws-9fbbac (main)]$ npx cdk version
1.104.0 (build 44d3383)
(.venv) [hoegertn@MacMini ws-9fbbac (main)]$ npx --ignore-existing cdk version
npx: the --ignore-existing argument has been removed.
See `npm help exec` for more information
1.104.0 (build 44d3383)
(.venv) [hoegertn@MacMini ws-9fbbac (main)]$ cdk
bash: cdk: command not found
(.venv) [hoegertn@MacMini ws-9fbbac (main)]$ 
(.venv) [hoegertn@MacMini ws-9fbbac (main)]$ npx --version
7.11.2
rix0rrr commented 3 years ago

Hm.

I see what you're saying, but I also see that npx cdk does not do an npm install (because I don't see the NPM progress bar).

Do you have cdk in ../node_modules/.bin or ../../node_modules/.bin or something?

If I make sure that npx cdk installs something by getting rid of traces of CDK in all kinds of node_modules dirs:

$ npx cdk ls
[npm install garble here]
PythonStack
rix0rrr commented 3 years ago

I do have NPM 6 but that feels like it shouldn't matter too much (but who knows)

shubham391 commented 3 years ago

Related issue: https://github.com/aws/aws-cdk/issues/14710

sudhirpandey commented 3 years ago

I seem to be running into the same issue , however my schema verison support seems to 9.0.0.

cdk bootstrap --debug
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),

By this post it seems it needs to work as long as cli is in same version with cdk lib, but its failing.

cdk --version
1.104.0 (build 44d3383)

pip list |grep aws
aws-cdk.assets                     1.104.0
aws-cdk.aws-apigateway             1.104.0
aws-cdk.aws-applicationautoscaling 1.104.0
aws-cdk.aws-autoscaling-common     1.104.0
aws-cdk.aws-certificatemanager     1.104.0
aws-cdk.aws-cloudformation         1.104.0
aws-cdk.aws-cloudwatch             1.104.0
aws-cdk.aws-codeguruprofiler       1.104.0
aws-cdk.aws-cognito                1.104.0
aws-cdk.aws-dynamodb               1.104.0
aws-cdk.aws-ec2                    1.104.0
aws-cdk.aws-ecr                    1.104.0
aws-cdk.aws-ecr-assets             1.104.0
aws-cdk.aws-efs                    1.104.0
aws-cdk.aws-elasticloadbalancingv2 1.104.0
aws-cdk.aws-events                 1.104.0
aws-cdk.aws-iam                    1.104.0
aws-cdk.aws-kinesis                1.104.0
aws-cdk.aws-kms                    1.104.0
aws-cdk.aws-lambda                 1.104.0
aws-cdk.aws-lambda-event-sources   1.104.0
aws-cdk.aws-logs                   1.104.0
aws-cdk.aws-route53                1.104.0
aws-cdk.aws-s3                     1.104.0
aws-cdk.aws-s3-assets              1.104.0
aws-cdk.aws-s3-notifications       1.104.0
aws-cdk.aws-sam                    1.104.0
aws-cdk.aws-secretsmanager         1.104.0
aws-cdk.aws-signer                 1.104.0
aws-cdk.aws-sns                    1.104.0
aws-cdk.aws-sns-subscriptions      1.104.0
aws-cdk.aws-sqs                    1.104.0
aws-cdk.aws-ssm                    1.104.0
aws-cdk.cloud-assembly-schema      1.104.0
aws-cdk.core                       1.104.0
aws-cdk.custom-resources           1.104.0
aws-cdk.cx-api                     1.104.0
aws-cdk.region-info                1.104.0

node --version
v15.5.1

npm --version
7.13.0
rix0rrr commented 3 years ago

I really need someone who has this problem to help me out because I can't seem to reproduce it. Can you do the following:

$ which cdk
(note down the path, exclude the 'bin/cdk' part)

$ cat /path/to/cdk/package.json
$ cat /path/to/cdk/node_modules/@aws-cdk/cloud-assembly-schema/package.json
$ cat /path/to/cdk/node_modules/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.version.json 

I want to know where the CDK CLI is found, and the contents of both package.jsons and cloud-assembly.version.json files.

It might be that .../node_modules/@aws-cdk/cloud-assembly-schema is not found IN the /path/to/cdk directory, but somewhere up the tree from there. So for example, it could either be in:

/usr/local/lib/node_modules/aws-cdk/node_modules/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.version.json 
# or in
/usr/local/lib/node_modules/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.version.json 
gerroldksky commented 3 years ago

$ which cdk /usr/local/bin/cdk

This is a symlink: /usr/local/bin/cdk -> ../lib/node_modules/aws-cdk/bin/cdk

$ cat /path/to/cdk/package.json
'/usr/local/lib/node_modules/aws-cdk/package.json'

{
  "name": "aws-cdk",
  "description": "CDK Toolkit, the command line tool for CDK apps",
  "version": "1.104.0",
  "main": "lib/index.js",
  "types": "lib/index.d.ts",
  "bin": {
    "cdk": "bin/cdk"
  },
  "scripts": {
    "build": "cdk-build",
    "watch": "cdk-watch",
    "lint": "cdk-lint",
    "pkglint": "pkglint -f",
    "test": "cdk-test",
    "integ": "jest --testMatch '**/?(*.)+(integ-test).js'",
    "package": "cdk-package",
    "build+test+package": "yarn build+test && yarn package",
    "build+test": "yarn build && yarn test",
    "integ-cli": "npm run integ-cli-regression && npm run integ-cli-no-regression",
    "integ-cli-regression": "npm run integ-cli-regression-latest-release && npm run integ-cli-regression-latest-code",
    "integ-cli-regression-latest-release": "test/integ/run-against-dist test/integ/test-cli-regression-against-latest-release.sh",
    "integ-cli-regression-latest-code": "test/integ/run-against-dist test/integ/test-cli-regression-against-current-code.sh",
    "integ-cli-no-regression": "test/integ/run-against-repo test/integ/cli/test.sh",
    "integ-init": "test/integ/run-against-dist test/integ/init/test-all.sh",
    "gen": "./generate.sh"
  },
  "cdk-build": {
    "jest": true
  },
  "cdk-package": {
    "shrinkWrap": true
  },
  "author": {
    "name": "Amazon Web Services",
    "url": "https://aws.amazon.com",
    "organization": true
  },
  "license": "Apache-2.0",
  "devDependencies": {
    "@aws-cdk/core": "1.104.0",
    "@octokit/rest": "^18.5.3",
    "@types/archiver": "^5.1.0",
    "@types/fs-extra": "^8.1.1",
    "@types/glob": "^7.1.3",
    "@types/jest": "^26.0.23",
    "@types/minimatch": "^3.0.4",
    "@types/mockery": "^1.4.29",
    "@types/node": "^10.17.59",
    "@types/promptly": "^3.0.1",
    "@types/semver": "^7.3.5",
    "@types/sinon": "^9.0.11",
    "@types/table": "^6.0.0",
    "@types/uuid": "^8.3.0",
    "@types/wrap-ansi": "^3.0.0",
    "@types/yargs": "^15.0.13",
    "aws-sdk-mock": "^5.1.0",
    "cdk-build-tools": "1.104.0",
    "jest": "^26.6.3",
    "make-runnable": "^1.3.8",
    "mockery": "^2.1.0",
    "nock": "^13.0.11",
    "pkglint": "1.104.0",
    "sinon": "^9.2.4",
    "ts-jest": "^26.5.6",
    "ts-mock-imports": "^1.3.4",
    "xml-js": "^1.6.11"
  },
  "dependencies": {
    "@aws-cdk/cloud-assembly-schema": "1.104.0",
    "@aws-cdk/cloudformation-diff": "1.104.0",
    "@aws-cdk/cx-api": "1.104.0",
    "@aws-cdk/region-info": "1.104.0",
    "archiver": "^5.3.0",
    "aws-sdk": "^2.848.0",
    "camelcase": "^6.2.0",
    "cdk-assets": "1.104.0",
    "colors": "^1.4.0",
    "decamelize": "^5.0.0",
    "fs-extra": "^9.1.0",
    "glob": "^7.1.7",
    "json-diff": "^0.5.4",
    "minimatch": ">=3.0",
    "promptly": "^3.2.0",
    "proxy-agent": "^4.0.1",
    "semver": "^7.3.5",
    "source-map-support": "^0.5.19",
    "table": "^6.7.0",
    "uuid": "^8.3.2",
    "wrap-ansi": "^7.0.0",
    "yaml": "1.10.2",
    "yargs": "^16.2.0"
  },
  "repository": {
    "url": "https://github.com/aws/aws-cdk.git",
    "type": "git",
    "directory": "packages/aws-cdk"
  },
  "keywords": [
    "aws",
    "cdk"
  ],
  "homepage": "https://github.com/aws/aws-cdk",
  "engines": {
    "node": ">= 10.13.0 <13 || >=13.7.0"
  },
  "nozem": {
    "ostools": [
      "git",
      "date",
      "cat",
      "dotnet",
      "mvn",
      "npm"
    ],
    "env": {
      "CODEBUILD_RESOLVED_SOURCE_VERSION": "|nzm-build"
    }
  },
  "stability": "stable",
  "maturity": "stable",
  "publishConfig": {
    "tag": "latest"
  }
}

$ cat /path/to/cdk/node_modules/@aws-cdk/cloud-assembly-schema/package.json
'/usr/local/lib/node_modules/aws-cdk/node_modules/@aws-cdk/cloud-assembly-schema/package.json'
{
  "_from": "@aws-cdk/cloud-assembly-schema@1.102.0",
  "_id": "@aws-cdk/cloud-assembly-schema@1.102.0",
  "_inBundle": false,
  "_integrity": "sha512-fOHjBc5/vp+rEPEXAZXuexU6emMan30dPWfecTLPE4pXa1bEWgiV9FtPCFAlRfNPXyWr4pBoD97Dy7daK1KC+w==",
  "_location": "/aws-cdk/@aws-cdk/cloud-assembly-schema",
  "_phantomChildren": {},
  "_requested": {
    "type": "version",
    "registry": true,
    "raw": "@aws-cdk/cloud-assembly-schema@1.102.0",
    "name": "@aws-cdk/cloud-assembly-schema",
    "escapedName": "@aws-cdk%2fcloud-assembly-schema",
    "scope": "@aws-cdk",
    "rawSpec": "1.102.0",
    "saveSpec": null,
    "fetchSpec": "1.102.0"
  },
  "_requiredBy": [
    "/aws-cdk",
    "/aws-cdk/@aws-cdk/cx-api",
    "/aws-cdk/cdk-assets"
  ],
  "_resolved": "https://registry.npmjs.org/@aws-cdk/cloud-assembly-schema/-/cloud-assembly-schema-1.102.0.tgz",
  "_shasum": "90201afa60f27e0b3a2bd270f9133a08b2317ec2",
  "_spec": "@aws-cdk/cloud-assembly-schema@1.102.0",
  "_where": "/usr/local/lib/node_modules/aws-cdk",
  "author": {
    "name": "Amazon Web Services",
    "url": "https://aws.amazon.com"
  },
  "awscdkio": {
    "announce": false
  },
  "awslint": {
    "exclude": []
  },
  "bugs": {
    "url": "https://github.com/aws/aws-cdk/issues"
  },
  "bundleDependencies": [
    "jsonschema",
    "semver"
  ],
  "cdk-build": {
    "jest": true
  },
  "dependencies": {
    "jsonschema": "^1.4.0",
    "semver": "^7.3.5"
  },
  "deprecated": false,
  "description": "Cloud Assembly Schema",
  "devDependencies": {
    "@types/jest": "^26.0.22",
    "@types/mock-fs": "^4.13.0",
    "@types/semver": "^7.3.4",
    "cdk-build-tools": "1.102.0",
    "jest": "^26.6.3",
    "mock-fs": "^4.13.0",
    "pkglint": "1.102.0",
    "typescript-json-schema": "^0.50.0"
  },
  "engines": {
    "node": ">= 10.13.0 <13 || >=13.7.0"
  },
  "homepage": "https://github.com/aws/aws-cdk",
  "jsii": {
    "outdir": "dist",
    "targets": {
      "java": {
        "package": "software.amazon.awscdk.cloudassembly.schema",
        "maven": {
          "groupId": "software.amazon.awscdk",
          "artifactId": "cdk-cloud-assembly-schema"
        }
      },
      "dotnet": {
        "namespace": "Amazon.CDK.CloudAssembly.Schema",
        "packageId": "Amazon.CDK.CloudAssembly.Schema",
        "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/master/logo/default-256-dark.png"
      },
      "python": {
        "distName": "aws-cdk.cloud-assembly-schema",
        "module": "aws_cdk.cloud_assembly_schema",
        "classifiers": [
          "Framework :: AWS CDK",
          "Framework :: AWS CDK :: 1"
        ]
      }
    },
    "projectReferences": true,
    "metadata": {
      "jsii": {
        "rosetta": {
          "strict": true
        }
      }
    }
  },
  "keywords": [
    "aws",
    "cdk"
  ],
  "license": "Apache-2.0",
  "main": "lib/index.js",
  "maturity": "stable",
  "name": "@aws-cdk/cloud-assembly-schema",
  "publishConfig": {
    "tag": "latest"
  },
  "repository": {
    "url": "git+https://github.com/aws/aws-cdk.git",
    "type": "git",
    "directory": "packages/@aws-cdk/cloud-assembly-schema"
  },
  "scripts": {
    "awslint": "cdk-awslint",
    "build": "cdk-build",
    "build+test": "yarn build && yarn test",
    "build+test+package": "yarn build+test && yarn package",
    "compat": "cdk-compat",
    "lint": "cdk-lint",
    "package": "cdk-package",
    "pkglint": "pkglint -f",
    "rosetta:extract": "yarn --silent jsii-rosetta extract",
    "test": "cdk-test",
    "update-schema": "bash scripts/update-schema.sh",
    "watch": "cdk-watch"
  },
  "stability": "stable",
  "types": "lib/index.d.ts",
  "version": "1.102.0"
}
$ cat /path/to/cdk/node_modules/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.version.json 

{"version":"10.0.0"}
gerroldksky commented 3 years ago

Looks like a few references to the older/previous 102 version in the cloud-assembly-schema/package.json

rix0rrr commented 3 years ago

Thanks a lot @gerroldksky, that is very helpful. Although even more confusing, because it don't understand why npm would install version 1.102 of cloud-assembly-schema, even though all the references clearly say 1.104.

rix0rrr commented 3 years ago

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.

hoegertn commented 3 years ago

In my last comment, you can see that I do not have a global cdk at all and I still get this error. I will search for other assembly packages on my machine.

binh-nguyen-exwzd commented 3 years ago

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.

gerroldksky commented 3 years ago

Yes, a complete aws-cdk uninstall and re-install has also fixed it for me. Something is/got 'broken' in the upgrade process. But happy enough that a simple uninstall/install fixed it. A bit of a 'face-palm' moment that I did not try this myself.....

Thanks to all on this thread for your prompt support, patience and help!

rix0rrr commented 3 years ago

I do not have a global cdk at all and I still get this error.

Not global, no, but it might be in a parent directory. npx would still find it that place.

EDIT: Did you see the NPM "install progress bar" while running npx cdk --version ?

hoegertn commented 3 years ago

I have no idea why but I could track it down to the npx folder containing cdk 1.105 but the node_modules inside where of version 1.102

Removing the npx cache solved it now.

rix0rrr commented 3 years ago

Hm, that's weird by itself because the npx directory should be removed automatically after running the program (i.e., it shouldn't persist and so shouldn't affect future runs).

What's even more interesting is that apparently you were stuck on 1.102 as well, same as for the OP. I wonder if there was something wrong with that version...

But at the same time, I tried installing 1.102 and then upgrading to 1.104, same as OP, and that worked fine for me.

This is so frustrating 🤬

hoegertn commented 3 years ago

And I had this with 103, 104, and 105 until I removed the folder manually now.

rix0rrr commented 3 years ago

I wonder if it's the npm-shrinkwrap.json or not. But I'm not sure how to confirm/disconfirm that hypothesis easily...

skinny85 commented 3 years ago

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.

skinny85 commented 3 years ago

This does not happen with NPM 6:

$ npm --version 
6.14.4

$ npm install aws-cdk@1.98.0 
npm WARN saveError ENOENT: no such file or directory, open '/Users/adamruka/workplace/cdk/on-call/cli-cx-api-bug/java-example-app/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/Users/adamruka/workplace/cdk/on-call/cli-cx-api-bug/java-example-app/package.json'
npm WARN java-example-app No description
npm WARN java-example-app No repository field.
npm WARN java-example-app No README data
npm WARN java-example-app No license field.
+ aws-cdk@1.98.0
added 201 packages from 189 contributors and audited 201 packages in 27.957s
17 packages are looking for funding
  run `npm fund` for details
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
> aws-sdk@2.903.0 postinstall /Users/adamruka/workplace/cdk/on-call/cli-cx-api-bug/java-example-app/node_modules/aws-cdk/node_modules/aws-sdk
> node scripts/check-node-version.js
npm WARN saveError ENOENT: no such file or directory, open '/Users/adamruka/workplace/cdk/on-call/cli-cx-api-bug/java-example-app/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/adamruka/workplace/cdk/on-call/cli-cx-api-bug/java-example-app/package.json'
npm WARN java-example-app No description
npm WARN java-example-app No repository field.
npm WARN java-example-app No README data
npm WARN java-example-app No license field.
+ aws-cdk@1.105.0
added 8 packages from 36 contributors, removed 29 packages, updated 20 packages and audited 180 packages in 27.184s
3 packages are looking for funding
  run `npm fund` for details
found 0 vulnerabilities

$ npx cdk synth 
Resources:
  JavaExampleAppQueue3527C576:
    Type: AWS::SQS::Queue
    Properties:
      VisibilityTimeout: 300
    UpdateReplacePolicy: Delete
    DeletionPolicy: Delete
    Metadata:
      aws:cdk:path: JavaExampleAppStack/JavaExampleAppQueue/Resource
  JavaExampleAppQueuePolicy971E1824:
    Type: AWS::SQS::QueuePolicy
    Properties:
      PolicyDocument:
        Statement:
          - Action: sqs:SendMessage
            Condition:
              ArnEquals:
                aws:SourceArn:
                  Ref: JavaExampleAppTopic433D6DC3
            Effect: Allow
            Principal:
              Service: sns.amazonaws.com
            Resource:
              Fn::GetAtt:
                - JavaExampleAppQueue3527C576
                - Arn
        Version: "2012-10-17"
      Queues:
        - Ref: JavaExampleAppQueue3527C576
    Metadata:
      aws:cdk:path: JavaExampleAppStack/JavaExampleAppQueue/Policy/Resource
  JavaExampleAppQueueJavaExampleAppStackJavaExampleAppTopic06BE8912B2D69E27:
    Type: AWS::SNS::Subscription
    Properties:
      Protocol: sqs
      TopicArn:
        Ref: JavaExampleAppTopic433D6DC3
      Endpoint:
        Fn::GetAtt:
          - JavaExampleAppQueue3527C576
          - Arn
    Metadata:
      aws:cdk:path: JavaExampleAppStack/JavaExampleAppQueue/JavaExampleAppStackJavaExampleAppTopic06BE8912/Resource
  JavaExampleAppTopic433D6DC3:
    Type: AWS::SNS::Topic
    Properties:
      DisplayName: My First Topic Yeah
    Metadata:
      aws:cdk:path: JavaExampleAppStack/JavaExampleAppTopic/Resource
skinny85 commented 3 years ago

Looks like someone already reported this to NPM: https://github.com/npm/cli/issues/3196

rix0rrr commented 3 years ago

I can only reproduce this if I install directly from npmjs.com using NPM 7. If I install from an alternative NPM repository like Verdaccio or CodeArtifact, the behavior doesn't reproduce.

TingDaoK commented 3 years ago

I have the same issue. I checked the aws-cdk version (by cdk --version) is the same as the one in my package.json and tried to install the latest version, but the error message is always like pleas upgrade CDK CLI. I resolved the error by npm ci. I guess some node modules are out of sync or something.

nirvana124 commented 3 years ago

I am facing this issue on version 1.106.1 as well as 1.108.1. I have tried uninstalling, used npm version 6.14.4 and 7.17.0 but still getting below error : 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 11.0.0, but found 12.0.0)

nirvana124 commented 3 years ago

After a lot of trials it is working for me for below settings: cdk lib version: 1.108.1 cdk cli version: 1.109.0 npm version: 7.17.0 node version: 14.17.1

gerroldksky commented 3 years ago

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

eXpire163 commented 3 years ago

Hi, i was using cdk in a WSL and i got the same error:

which cdk pointed to /mnt/c/Users/xxx/AppData/Roaming/npm/cdk removed it there and then it pointed to /usr/local/bin/cdk and everything was OK

Nicko-13 commented 3 years ago

The issue is still persisting with CDK version 1.116.0. npm install -g aws-cdk@1.116.0 still install version 1.113.0.

ishanjain28 commented 3 years ago

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.

ganeshnj commented 3 years ago

Encountered similar issue when deploying to AppRunner

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 11.0.0, but found 13.0.
jpSimkins commented 3 years ago

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.

m1mohamad commented 2 years ago

I uninstalled it then did the following but still see the failure without npx:

$ npm install -g aws-cdk

added 198 packages, and audited 199 packages in 10s

found 0 vulnerabilities $ 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 14.0.0, but found 15.0.0) $ npx cdk synth Resources: CDKMetadata: Type: AWS::CDK::Metadata Properties: Analytics: v2:deflate64:H4sIAAAAAAAA/zPUMzQ21TNQdEgsL9ZNTsnWT84vStWrDi5JTM7Wcc7PKy4pKk0u0XFOywtKLc4vLUpOrdXJy09J1csq1i8zNAPq1jNUzCrOzNQtKs0rycxN1QuC0ADLxBKHWQAAAA== Metadata: aws:cdk:path: CdkappStack/CDKMetadata/Default

$ npm --version 8.2.0

antonrogo1 commented 2 years ago

Hi, I recently began experiencing similar issue: 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 15.0.0, but found 16.0.0)

Running commands npm uninstall -g aws-cdk npm install -g aws-cdk didn't do the trick.

cdk --version 2.5.0 (build 0951122)

node --version v12.22.5

npm --version 6.14.14

seanmcclory commented 2 years ago

I'm getting the same issue too on a new stack, and reinstalling aws-cdk also doesn't fix it.

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 15.0.0, but found 16.0.0)

cdk --version 2.5.0 (build 0951122)

node --version v14.15.4

npm --version 8.3.0 or 6.14.15

MinCheTsai commented 2 years ago

I'm getting the same issue too on a new stack, and reinstalling aws-cdk also doesn't fix it.

same problem

cdk --version 2.2.0 (build 4f5c27c)

node --version v14.18.1

npm --version 6.14.15

jezxube commented 2 years ago

I'm getting the same issue using CodeBuild:


[Container] 2022/01/12 08:49:52 Running command npm install -g aws-cdk
/usr/local/bin/cdk -> /usr/local/lib/node_modules/aws-cdk/bin/cdk
 + aws-cdk@2.5.0
added 213 packages from 233 contributors in 6.632s
 
[Container] 2022/01/12 08:49:59 Running command cdk version
2.5.0 (build 0951122)

[Container] 2022/01/12 08:50:02 Running command 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 15.0.0, but found 16.0.0)
gshpychka commented 2 years ago

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.
jezxube commented 2 years ago

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.

Solution 1 worked for me - thanks!

ahileseverquote commented 2 years ago

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.

Thanks @gshpychka - Solutions 1 and 2 have helped unblock my team.

OrGamliel8 commented 2 years ago

Solution 1 worked for me too !

skinny85 commented 2 years ago

Related issue: https://github.com/aws/aws-cdk/issues/18370.

addihorowitz commented 2 years ago

This issue was resolved by #18370.

github-actions[bot] commented 2 years ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

0xBradock commented 2 years ago

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.1 cdk --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,

jsadoski-rockhall commented 1 year ago

In my case, I was using the npm workspaces feature. When using a workspace, npx uses the bin installed in the workspace.

Out of workspace:

> npx cdk --version
2.82.0 (build 3a8648a)

In workspace:

> npx cdk --version  
2.76.0 (build 78c411b)

(This matches my package.json.)