Conversation
The Cognito trigger schemas rejected events Cognito sends in common flows, so custom auth flows and custom email senders could not be parsed at all. - PreSignup, PostConfirmation, and the custom email and SMS sender schemas accept every documented triggerSource instead of a single one. - The custom sender schemas no longer require a response, which real events don't have, and accept a null clientMetadata. - The Define and Create auth challenge schemas accept an empty session, which the first call of a custom auth flow without SRP sends. - The Verify auth challenge schema accepts a null answerCorrect, which Cognito sends for the function to set. - callerContext.clientId accepts null, which admin API operations send. Add the captured events from the issue as fixtures, with a round-trip test for each. Closes aws-powertools#5770
Contributor
|
This is looking good, one change I'd like, which I should have mentioned in the issue. Rather than have lots of JSON files, let's have a single one that we use to derive the other events. You can see an example in #3388. |
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The Cognito trigger schemas rejected events Cognito sends in common flows, so custom auth flows and custom email senders could not be parsed at all. This aligns them with the events captured from a live user pool in the issue and with the trigger sources reference.
Changes
PreSignupTriggerSchemaandPostConfirmationTriggerSchemaaccept every documentedtriggerSourcefor their trigger (PreSignUp_AdminCreateUser,PreSignUp_ExternalProvider,PostConfirmation_ConfirmForgotPassword) instead of a single literal.CustomEmailSenderTriggerSchemaandCustomSMSSenderTriggerSchemaaccept every documented source for their trigger, no longer require aresponse(real events have none, since Cognito expects nothing back), and accept a nullclientMetadata.DefineAuthChallengeTriggerSchemaandCreateAuthChallengeTriggerSchemaaccept an emptysession, which the first call of a custom auth flow without SRP sends.VerifyAuthChallengeTriggerSchemaaccepts a nullresponse.answerCorrect, which Cognito sends for the function to set.callerContext.clientIdaccepts null in the shared base schema, which admin API operations such asAdminConfirmSignUpsend.main. The two existing custom sender tests no longer pass aresponse, matching real events, and the custom sender JSDoc examples drop it too.PreSignUp_ExternalProviderand the custom SMS sender sources come from the documentation, since they weren't captured. The trigger sources overview spells the SMS sourcesCustomSmsSender_*, while the custom SMS sender page and the API mapping table useCustomSMSSender_*, matching the existing literal, so I used the latter.Issue number: closes #5770
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.