-
Notifications
You must be signed in to change notification settings - Fork 0
Add error handling when Amplify AppId is invalid and doesn't exist in the configured region #10
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
base: main
Are you sure you want to change the base?
Conversation
…p IDs Validates app IDs for branch deployments and provides clear error messaging when an invalid app ID is provided in the configured region.
Resolves #7 |
To provide feedback, navigate to the Files changed tab and leave comments on the proposed code changes. Choose Start review for each comment, and then choose Request changes, and I'll propose revised changes. |
⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done |
✅ I finished the code review, and didn't find any security or code quality issues. |
resolveMainStackName = async (): Promise<string> => { | ||
// If the backendId has a namespace (which is the appId for branch type), validate it exists | ||
if (this.backendId.type === 'branch' && this.amplifyClient) { | ||
try { | ||
await this.amplifyClient.send( | ||
new GetAppCommand({ appId: this.backendId.namespace }) | ||
); | ||
} catch (error) { | ||
if (error instanceof ResourceNotFoundException) { | ||
const region = await this.amplifyClient.config.region(); | ||
throw new BackendOutputClientError( | ||
BackendOutputClientErrorType.INVALID_APP_ID, | ||
`App with ID '${this.backendId.namespace}' does not exist in region ${region}. Please check the App ID and region configuration.` | ||
); | ||
} | ||
throw error; | ||
} | ||
} | ||
|
||
return BackendIdentifierConversions.toStackName(this.backendId); | ||
}; |
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.
add unit tests for this.
✅ I updated this pull request based on the feedback. To provide feedback, navigate to the Files changed tab and leave comments on the proposed code changes. Choose Start review for each comment, and then choose Request changes, and I'll propose revised changes. |
Implements validation for Amplify app IDs and adds comprehensive backend identifier resolution with test coverage. Includes support for sandbox fallback and proper error handling for invalid app IDs.
This pull request enhances the invalid app ID error handling in the deployment client. It adds validation to check if an Amplify app ID exists in the configured region when using branch-based deployments. If the app ID is not found, it throws a more user-friendly error message that includes both the invalid app ID and the region, helping developers quickly identify and fix app ID configuration issues. The changes primarily impact the backend identifier resolution and error handling components of the deployment system.