Skip to content

Fix type for claims_to_add_or_override in CognitoEventUserPoolsPreTokenGenV2#1100

Merged
jlizen merged 1 commit intoaws:mainfrom
AbhigyaKrishna:fix/cognito-pre-token-v2
Feb 19, 2026
Merged

Fix type for claims_to_add_or_override in CognitoEventUserPoolsPreTokenGenV2#1100
jlizen merged 1 commit intoaws:mainfrom
AbhigyaKrishna:fix/cognito-pre-token-v2

Conversation

@AbhigyaKrishna
Copy link
Contributor

📬 Issue #, if available: #1099

✍️ Description of changes:
claims_to_add_or_override now has the correct type for overriding complex structure in claims. Pre token generation Lambda trigger V2_0 allows to pass complex datatypes to ID and access token claim values.

🔏 By submitting this pull request

  • I confirm that I've ran cargo +nightly fmt.
  • I confirm that I've ran cargo clippy --fix.
  • I confirm that I've made a best effort attempt to update all relevant documentation.
  • I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jlizen
Copy link
Collaborator

jlizen commented Feb 16, 2026

This will be flagged as semver breaking, but the argument is that the previous case was a bug and would lead to incorrect deserialization failures? (Or would it? I think no, it would just cast everything to String)?

According to the bug argument will need to bypass cargo semver check for it I guess?

But, I'm wondering if we should instead be preserving old String and offering a new API for json? This seems parallel to: #977

Copy link
Collaborator

@jlizen jlizen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reread the upstream docs, and they are very explicit that this field is a complex object:
https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-pre-token-generation.html#cognito-pretoken-complex-objects-note

And, v1 explicitly does not have the complex type, so this is likely something that was present since the start of the protocol version.

So - sorry to anybody that this might break, but this is a bug that needs to be fixed, albeit very belatedly. It is blocking conventional use of the field for future users.

Thanks for the contribution, @AbhigyaKrishna !

@jlizen
Copy link
Collaborator

jlizen commented Feb 19, 2026

Semver check failures are expected as this is a bugfix of a public type.

@jlizen jlizen merged commit b3c4f9e into aws:main Feb 19, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments