Reputation: 407
I can't understand why the Cognito Lambda triggers are not created. The lambdas are created, but the list of triggers in the AWS console is empty and I have to choose them manually.
const postConfirmationLambda = new NodejsFunction(
this,
'PostConfirmLambda',
userPoolLambdasProps
);
const postAuthenticationLambda = new NodejsFunction(
this,
'PostAuthLambda',
userPoolLambdasProps
);
usersTable.grantReadWriteData(postConfirmationLambda);
usersTable.grantReadWriteData(postAuthenticationLambda);
const userPool = new UserPool(this, 'UserPool', {
removalPolicy: RemovalPolicy.DESTROY,
lambdaTriggers: {
postConfirmationLambda,
postAuthenticationLambda,
},
});
Upvotes: 0
Views: 679
Reputation: 11482
lambdaTriggers
expects a UserPoolTriggers
interface type: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.UserPoolTriggers.html
It would look like this:
const userPool = new UserPool(this, 'UserPool', {
removalPolicy: RemovalPolicy.DESTROY,
lambdaTriggers: {
postConfirmation: postConfirmationLambda,
postAuthentication: postAuthenticationLambda,
},
});
Upvotes: 1