Skip to content

CognitoEventUserPoolsPreTokenGenV2 deserialization error when groupConfiguration is null #1129

@jct-tympanon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions