-
Notifications
You must be signed in to change notification settings - Fork 72
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
vigy02
wants to merge
15
commits into
aws-amplify:main
Choose a base branch
from
vigy02:fix/AppNotFound
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
16e96d7
Added error mapping for app name not found fault
vigy02 f0e0bbe
Updated the test case for this fault
vigy02 645e1e0
Updated the mapper and the test case to catch the AppNotFound Error
vigy02 28a37d6
Updated the code to catch the error app name not available in the region
vigy02 afb801e
Merge branch 'aws-amplify:main' into fix/AppNotFound
vigy02 a2c4031
Updated backend identifier resolver
vigy02 a5692a0
Updated to handle the No apps found error
vigy02 6e73f46
Updated generate-graphql command as well to catch the error
vigy02 33b2ccd
reset the backend resolver
vigy02 536dad0
Updated the error code and added test cases to test the error handling
vigy02 eab450f
chore: Updated the API
vigy02 b400709
chore: updated API
vigy02 37b62bb
Updated error handling to show the full error details
vigy02 3236c1e
added the unit test cases to the existing test suite
vigy02 31b406a
fixed lint errors
vigy02 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@aws-amplify/backend-cli': patch | ||
--- | ||
|
||
Added error mapping for app name not available in the region |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
import { MainStackNameResolver } from '@aws-amplify/plugin-types'; | ||
import { AmplifyClient, ListAppsCommand } from '@aws-sdk/client-amplify'; | ||
import { BackendIdentifierConversions } from '@aws-amplify/platform-core'; | ||
import { | ||
BackendOutputClientError, | ||
BackendOutputClientErrorType, | ||
} from '../backend_output_client_factory.js'; | ||
Comment on lines
+4
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
/** | ||
* Tuple of Amplify App name and branch | ||
|
@@ -38,7 +42,8 @@ export class AppNameAndBranchMainStackNameResolver | |
); | ||
const region = await this.amplifyClient.config.region(); | ||
if (appMatches.length === 0) { | ||
throw new Error( | ||
throw new BackendOutputClientError( | ||
BackendOutputClientErrorType.NO_APP_FOUND_ERROR, | ||
`No apps found with name ${this.appNameAndBranch.appName} in region ${region}` | ||
); | ||
} else if (appMatches.length >= 2) { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the lint, don't use instanceof as it might not work if there are multiple versions of DeployedBackendClient package in the node_modules.