gpt4 book ai didi

aws-cloudformation - AWS Cognito Lambda 触发器不是使用 CDK 创建的

转载 作者:行者123 更新时间:2023-12-03 07:33:29 24 4
gpt4 key购买 nike

我不明白为什么不创建 Cognito Lambda 触发器。 lambda 已创建,但 AWS 控制台中的触发器列表为空,我必须手动选择它们。

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,
},
});

Full code

CloudFormation template

最佳答案

lambdaTriggers 需要一个 UserPoolTriggers 接口(interface)类型:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.UserPoolTriggers.html

它看起来像这样:

const userPool = new UserPool(this, 'UserPool', {
removalPolicy: RemovalPolicy.DESTROY,
lambdaTriggers: {
postConfirmation: postConfirmationLambda,
postAuthentication: postAuthenticationLambda,
},
});

关于aws-cloudformation - AWS Cognito Lambda 触发器不是使用 CDK 创建的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73053565/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com