Skip to content

CognitoEventUserPoolsPreTokenGenV2 deserialization error when groupConfiguration is null #1129

Closed

Description

@jct-tympanon

Cognito's pre-token v2 hook can sometimes receive a null groupConfiguration field value. The cognito documentation includes example JSON rather than schema, so it's not clear whether this is a cognito bug or not. But it definitely happens at runtime for some user pools.

In any case, the rust structure fails to deserialize the event with

PreTokenGenerationV2_0 failed with error failed to deserialize the incoming data into the function's payload type: [request.groupConfiguration] request.groupConfiguration: invalid type: null, expected struct GroupConfiguration at line 1 column 835

In any case, the obvious backwards-compatible fix is to add #[serde(default)] to the field. Looks like maybe that was the intent and it just got missed on that field? Happy to test the fix / send a PR.

Activity

  1. jlizen commented on Mar 17, 2026

    @jlizen
    Member

    Adding the default is good, thanks!

  2. jct-tympanon commented on Mar 18, 2026

    @jct-tympanon
    ContributorAuthor

    PR sent. i had to do a little more than "serde(default)", but it follows the pattern of other fields nearby. i verified the patch in my own cognito app (with a V2 pre-token trigger).

  3. github-actions commented on Mar 19, 2026

    @github-actions

    This issue is now closed. Comments on closed issues 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.

  4. jlizen commented on Mar 19, 2026

    @jlizen
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions