Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Type for CognitoEventUserPoolsCustomEmailSender #370

Open
makeitraina opened this issue Mar 28, 2021 · 5 comments
Open

Event Type for CognitoEventUserPoolsCustomEmailSender #370

makeitraina opened this issue Mar 28, 2021 · 5 comments
Labels
enhancement type/events issue or feature request related to the events package

Comments

@makeitraina
Copy link

Is your feature request related to a problem? Please describe.
The events types include types for all cognito event triggers except for the custom sender triggers. It seems there should be types for the custom email sender event and custom sms sender event. This is so that the functionality described here can be implemented in a golang lambda.

Describe the solution you'd like
I think the solution is to have an event type for CognitoEventUserPoolsCustomEmailSender

Describe alternatives you've considered
Trying to use the existing type of CognitoEventUserPoolsCustomMessage since it most closely resembles this function. Naturally I have not tested this extensively to see what data is missing/would cause an error.

My current handler signature looks like

func handler(event events.CognitoEventUserPoolsCustomMessage) (events.CognitoEventUserPoolsCustomMessage, error) {
@PrakashSuthar
Copy link

@makeitraina
Were u able to use custom sender triggers using the above function signature of CustomMessage?

@BorisLeMeec
Copy link

@PrakashSuthar
I tried with events.CognitoEventUserPoolsCustomMessage and the lambda seems to work but there is at least the request.Trigger.Code that is missing. (the code used to confirm an email or a phone number). So unexploitable.

@bmoffatt bmoffatt added enhancement type/events issue or feature request related to the events package labels Dec 20, 2022
@geekytaurus115
Copy link

CognitoEventUserPoolsCustomMessage

I'm facing the same issue, unable to find Request.Code inside the struct CognitoEventUserPoolsCustomMessage although there is a key named Request.CodeParameter, is this the same?

@KlemenKozelj
Copy link

There seems to be an issue with official event struct CognitoEventUserPoolsCustomMessage:

type CognitoEventUserPoolsCustomMessage struct {

Actual event that is received into lambda is:

{
        "callerContext": {
            "awsSdkVersion": "aws-sdk-unknown-unknown",
            "clientId": "clientId"
        },
        "region": "eu-central-1",
        "request": {
            "clientMetadata": null,
            "code": "cipher text",
            "type": "customEmailSenderRequestV1",
            "userAttributes": {
                "cognito:email_alias": "john.doe@email.com",
                "cognito:user_status": "UNCONFIRMED",
                "email": "john.doe@email.com",
                "email_verified": "false",
                "sub": "1-2-3"
            }
        },
        "triggerSource": "CustomEmailSender_ResendCode",
        "userName": "1-2-3",
        "userPoolId": "eu-central-1_123",
        "version": "1"
    }

@bradmcf
Copy link

bradmcf commented Oct 31, 2024

This is an issue with the CognitoEventUserPoolsCustomMessage struct as @KlemenKozelj mentioned above.

The specific issue is the json attribute that the struct is searching for to populate the CodeParameter value. It is searching for codeParameter but it should be searching for code.

I worked around this by copying those structs into my lambda and modifying the above, then using that type directly instead of using it under the events namespace.

Would be good for this to get a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement type/events issue or feature request related to the events package
Projects
None yet
Development

No branches or pull requests

7 participants