question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws-cognito): lambdaConfig.customEmailSender description seems incorrect

See original GitHub issue

https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cognito.CfnUserPool.CustomEmailSenderProperty.html

The docs say lambdaArn and lambdaVersion are both optional. However, when I specify this in my code:

  userPool.lambdaConfig = {
    customEmailSender: {
      lambdaArn: props.cognitoEmailSender.functionArn,
    },
  };

I get this error upon deployment to CloudFormation:

1 validation error detected: Value null at 'lambdaConfig.customEmailSender.lambdaVersion' failed to satisfy constraint: Member must not be null (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID: 5383d3db-671c-4fa0-b85d-c659dfc3c29a; Proxy: null)

So the Lambda version is required?


This is a 📕 documentation issue

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
ffxsamcommented, Sep 8, 2021

@RatulSaha Sure!

  const userPool = new cognito.UserPool(stack, 'UserPool', {
    // ... params
  });

  const cognitoEmailSender = new sst.Function(stack, 'CognitoEmailSender', {
    functionName: `${stack.stackName}-cognitoEmailSender`,
    handler: 'lambda/auth/cognito-email-sender.main',
  });

  // Allow Cognito to invoke the email sender Lambda
  cognitoEmailSender.grantInvoke(
    new iam.ServicePrincipal('cognito-idp.amazonaws.com')
  );

  const kmsKey = new kms.Key(stack, 'AuthKmsKey', {
    description: 'Required by Cognito',
    removalPolicy:
      stack.stage === 'prod' ? RemovalPolicy.RETAIN : RemovalPolicy.DESTROY,
  });

  (userPool.node.defaultChild as cognito.CfnUserPool).lambdaConfig = {
    customEmailSender: {
      lambdaArn: cognitoEmailSender.functionArn,
      lambdaVersion: 'V1_0',
    },
    kmsKeyId: kmsKey.keyArn,
  };
0reactions
github-actions[bot]commented, Sep 20, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

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. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS CloudFormation: Cognito LambdaTrigger ...
After testing CustomEmailSender CDK implementation, I have to say that the AWS CloudFormation Documentation hasn't a current state.
Read more >
update-user-pool — AWS CLI 1.27.37 Command Reference
A custom email sender Lambda trigger. LambdaVersion -> (string). Signature of the "request" attribute in the "event" information Amazon Cognito passes to your ......
Read more >
update-user-pool — AWS CLI 2.1.30 Command Reference
The AWS Lambda configuration information from the request to update the user ... and temporary passwords sent to CustomEmailSender and CustomSMSSender .
Read more >
How we use Customer.io to send custom welcome emails ...
Cognito then uses a custom email sender to send the email address and ... we wind up with an email in Customer.io that...
Read more >
Not authorized to perform lambda:InvokeFunction from ...
Regarding your problem the only thing seems to work is: ... the pool (using cli command aws cognito-idp describe-user-pool ) and the trigger ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found