Feature request: Add Cognito trigger models in parser utility
Use case
Original issue in TypeScript: https://github.com/aws-powertools/powertools-lambda-typescript/issues/3675
We should add schemas for Cognito Lambda triggers. Lambda triggers customize the flow of user pool sign-up, authentication, etc. Details are in docs.
Solution/User Experience
Add all models
Alternative solutions
Acknowledgment
- [x] This feature request meets Powertools for AWS Lambda (Python) Tenets
- [x] Should this be considered in other Powertools for AWS Lambda languages? i.e. Java, TypeScript, and .NET
I'm leaving it open for a while! If anyone wants to pick it up and work on it, please let me know and I can give some guidance.
Hi @leandrodamascena , I would like to work on this, also I am working on the mentioned original issue 3675 in Typescript tools so have some basic idea.
Hey @VatsalGoel3! Yes, please go ahead with this implementation! If you have any questions about the Python implementation, please let me know!
I'm assigning this issue to you.
Hey @VatsalGoel3! I see that you're working on this PR https://github.com/aws-powertools/powertools-lambda-typescript/pull/3729 in TypeScript and I think make sense you finish first TypeScript implementation and then we can port it to Python. I'm putting this issue in the backlog and will assign you when we merge the TS version.
Thanks
@leandrodamascena, The TS version for the cognito schema issue is closed and completed now, so if you want to open this up and assign me again.
Thank you
Hey @VatsalGoel3! Sure!!
I'm assigning to you.
Hey, @leandrodamascena sorry I could not get to this, was busy with some other work, is it still in consideration?
Hey @VatsalGoel3! Yes, pls go ahead
@leandrodamascena, I’ve been updating the Cognito trigger Pydantic models to match our existing tests/events/*.json fixtures, but I’m still seeing test failures in several schemas:
PostConfirmation: email_verified comes through as a bool but the model expects str UserMigration: response.userAttributes is completely absent in the fixture CustomMessage / CustomEmailSender / CustomSMSSender: fields like awsSdkVersion are named awsSdk, and email_verified/phone_number_verified are bools not strings Define/Create/Verify Auth Challenge: challengeMetadata, various response fields are empty objects rather than fully populated
Before I either relax these validators or tweak the fixtures, could I get guidance on which approach you’d prefer? Should we:
- Loosen the Pydantic schemas (e.g. accept bool | str, alias awsSdk → awsSdkVersion, make those response sub-fields optional), or
- Update the JSON fixtures to always include those fields in the expected format?
Hi @VatsalGoel3 I think you can create a PR with these tests and we can discuss this in the PR. I think I need to understand better what is failing and then decide how to fix it.
WDYT?
I made the pull request, let me know your thoughts
⚠️COMMENT VISIBILITY WARNING⚠️
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.