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

Add error mapping for Amplify app not found in specified region #2313

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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/tasty-rivers-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aws-amplify/backend-deployer': patch
---

Added error mapping for app name not available in the region
7 changes: 7 additions & 0 deletions packages/backend-deployer/src/cdk_error_mapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,13 @@ npm error enoent`,
errorName: 'LambdaEmptyZipFault',
expectedDownstreamErrorMessage: undefined,
},
{
errorMessage: 'Error: No apps found with name my-app in region us-west-2',
expectedTopLevelErrorMessage:
'No Amplify app found with name "my-app" in region "us-west-2".',
errorName: 'AmplifyAppNotFoundError',
expectedDownstreamErrorMessage: undefined,
},
];

void describe('invokeCDKCommand', { concurrency: 1 }, () => {
Expand Down
17 changes: 16 additions & 1 deletion packages/backend-deployer/src/cdk_error_mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,20 @@ export class CdkErrorMapper {
errorName: 'CloudFormationDeploymentError',
classification: 'ERROR',
},
// This type of error often occurs when:
// Users have not deployed their app to the specified region.
// There's a mismatch between the app name in the local configuration and the deployed app name.
// Users are working in a different AWS account or region than where the app is deployed.
{
errorRegex:
/No apps found with name (?<appName>.*) in region (?<region>.*)/,
humanReadableErrorMessage:
'No Amplify app found with name "{appName}" in region "{region}".',
resolutionMessage:
'Ensure that an Amplify app named "{appName}" exists in the "{region}" region.',
errorName: 'AmplifyAppNotFoundError',
classification: 'ERROR',
},
vigy02 marked this conversation as resolved.
Show resolved Hide resolved
];
}

Expand Down Expand Up @@ -528,4 +542,5 @@ export type CDKDeploymentError =
| 'SyntaxError'
| 'GetLambdaLayerVersionError'
| 'LambdaEmptyZipFault'
| 'LambdaMaxSizeExceededError';
| 'LambdaMaxSizeExceededError'
| 'AmplifyAppNotFoundError';
Loading