aws-samples / aws-samples/image-optimization

CDK CLI and aws-cdk-lib version mismatch leads to deployment errors

Open
#75 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
276
Forks
151
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
The example `package.json` uses different versions for `aws-cdk` (CLI) and `aws-cdk-lib` (library). For example:
```
"devDependencies": {
"aws-cdk": "2.121.1"
},
"dependencies": {
"aws-cdk-lib": "2.189.1"
}
```
This version mismatch causes deployment errors such as:

```
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 36.0.0, but found 41.0.0)
```

**Expected behavior**
The project should work out of the box without version mismatch errors. The `aws-cdk` CLI version should match the `aws-cdk-lib` version in `package.json` to avoid schema incompatibility.

**Desktop (please complete the following information):**
- OS & version: [Any]
- Node version (`node -v`): [Any recent LTS]
- npm version (`npm -v`): [Any recent]

**Additional context**
See CDK documentation for details: https://docs.aws.amazon.com/cdk/v2/guide/work-with-cdk-typescript.html#typescript-dependencies

**Suggested fix:**
Align the `aws-cdk` devDependency version with the `aws-cdk-lib` dependency version in the example `package.json` (e.g., both set to `2.189.1`). This will help users avoid deployment errors related to schema version mismatch.

---

I tried updating both packages to the latest versions:
```
"aws-cdk": "^2.1031.0",
"aws-cdk-lib": "^2.221.0"
```
After that, running `npx cdk bootstrap` succeeded without any issues.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.