Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add cdk error mapping for error 'command cdk not found' #2294

Merged
merged 2 commits into from
Dec 4, 2024
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/rude-moles-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aws-amplify/backend-deployer': patch
---

add cdk error mapping for error "cdk command not found"
6 changes: 6 additions & 0 deletions packages/backend-deployer/src/cdk_error_mapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,12 @@ const testErrorMappings = [
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)`,
},
{
errorMessage: `error Command cdk not found. Did you mean cdl?`,
expectedTopLevelErrorMessage: 'Unable to detect cdk installation',
errorName: 'CDKNotFoundError',
expectedDownstreamErrorMessage: `error Command cdk not found. Did you mean cdl?`,
},
{
errorMessage: `[31m amplify-some-stack failed: ValidationError: Stack:stack-arn is in UPDATE_ROLLBACK_FAILED state and can not be updated.`,
expectedTopLevelErrorMessage:
Expand Down
9 changes: 9 additions & 0 deletions packages/backend-deployer/src/cdk_error_mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ export class CdkErrorMapper {
errorName: 'CDKVersionMismatchError',
classification: 'ERROR',
},
{
errorRegex: /Command cdk not found/,
humanReadableErrorMessage: 'Unable to detect cdk installation',
resolutionMessage:
"Ensure dependencies in your project are installed with your package manager. For example, by running 'yarn install' or 'npm install'",
errorName: 'CDKNotFoundError',
classification: 'ERROR',
},
{
errorRegex: new RegExp(
`(SyntaxError|ReferenceError|TypeError)( \\[[A-Z_]+])?:((?:.|${this.multiLineEolRegex})*?at .*)`
Expand Down Expand Up @@ -460,6 +468,7 @@ export type CDKDeploymentError =
| 'BootstrapDetectionError'
| 'BootstrapOutdatedError'
| 'CDKAssetPublishError'
| 'CDKNotFoundError'
| 'CDKResolveAWSAccountError'
| 'CDKVersionMismatchError'
| 'CFNUpdateNotSupportedError'
Expand Down
Loading