-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(site launch): Allow for ops to remove timed out domain associations #720
feat(site launch): Allow for ops to remove timed out domain associations #720
Conversation
technically we mock both create and get calls, changing the var name to reflect this
redundant associations
) { | ||
if (!this.mockDomainAssociations.has(input.domainName)) { | ||
throw new AmplifyError( | ||
`NotFoundException: Domain association ${input.domainName} not found.` |
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.
This mocks the behaviour of the real amplify client and throws an exception if domain hasnt been created yet
getDomainAssociationCommandInput | ||
) | ||
const hasDomainAssociationFailed = | ||
getDomainAssociationResult?.domainAssociation?.domainStatus === "FAILED" |
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.
Refer here for types of domain association result
@@ -159,6 +161,41 @@ export class LaunchesService { | |||
throw siteIdResult.error | |||
} | |||
|
|||
try { |
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.
Wrapped in a try catch since AmplifySDK will throw an (expected) not found error, which is still the happy path
Problem
If we try to associate the same domain twice, Amplify will generally throw a
BadRequestException: One or more domains requested are already associated with another Amplify app
, which can inform the user to delete + retry.However, this did not hold true if the domain association process timed out, in which case Amplify did not throw an error, and neither did it create a new Domain Association during the
CreateDomainAssociation
call.To replicate the bug, this sequence of errors would need to happen:
One would think that the email received in step 5 is the most recent values, but it is in fact a lingering DomainAssociation that has yet to be deleted.
Closes IS93
Solution
Before calling a
CreateDomainAssociation
, delete any failed domain associations for the application.Breaking Changes
Testing
While I have tested it manually on the
kishore-test
app, it is a bit hard to easily replicate this test this as it requires the existence of an App timeout over 24 hours. :/