Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spicy-monkeys-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aws-amplify/backend-deployer': patch
---

Handle CDK version mismatch
1 change: 1 addition & 0 deletions .eslint_dictionary.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"argv",
"arn",
"arns",
"aws",
"backends",
"birthdate",
"bundler",
Expand Down
9 changes: 9 additions & 0 deletions packages/backend-deployer/src/cdk_error_mapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,15 @@ const testErrorMappings = [
errorName: 'FilePermissionsError',
expectedDownstreamErrorMessage: `EACCES: permission denied, unlink '.amplify/artifacts/cdk.out/synth.lock'`,
},
{
errorMessage: `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 36.1.1)`,
expectedTopLevelErrorMessage:
"Installed 'aws-cdk' is not compatible with installed 'aws-cdk-lib'.",
errorName: 'CDKVersionMismatchError',
expectedDownstreamErrorMessage: `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 36.1.1)`,
},
];

void describe('invokeCDKCommand', { concurrency: 1 }, () => {
Expand Down
11 changes: 11 additions & 0 deletions packages/backend-deployer/src/cdk_error_mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ export class CdkErrorMapper {
errorName: 'BootstrapNotDetectedError',
classification: 'ERROR',
},
{
errorRegex:
/This CDK CLI is not compatible with the CDK library used by your application\. Please upgrade the CLI to the latest version\./,
humanReadableErrorMessage:
"Installed 'aws-cdk' is not compatible with installed 'aws-cdk-lib'.",
resolutionMessage:
"Make sure that version of 'aws-cdk' is greater or equal to version of 'aws-cdk-lib'",
errorName: 'CDKVersionMismatchError',
classification: 'ERROR',
},
{
errorRegex: new RegExp(
`(SyntaxError|ReferenceError|TypeError):((?:.|${this.multiLineEolRegex})*?at .*)`
Expand Down Expand Up @@ -272,6 +282,7 @@ export type CDKDeploymentError =
| 'BackendSynthError'
| 'BootstrapNotDetectedError'
| 'CDKResolveAWSAccountError'
| 'CDKVersionMismatchError'
| 'CFNUpdateNotSupportedError'
| 'CloudFormationDeploymentError'
| 'FilePermissionsError'
Expand Down