[英]Circular dependency between resources. Cognito - lambda trigger
I have a SAM template that was working fine until I added a trigger to my cognito user pool.我有一个 SAM 模板,在我将触发器添加到我的 Cognito 用户池之前,它工作正常。
I searched about the error that is throwing me: Circular dependency between resources
I can understand that the trigger is creating a reference to the user pool and then the circular dependency arises, but I can not find how to solve the problem .我搜索了引发我的错误:
Circular dependency between resources
我可以理解触发器正在创建对用户池的引用,然后出现循环依赖,但我找不到解决问题的方法。 I only need to set the trigger of my cognito user pool to get custom messages/emails when a user is created.我只需要设置我的 Cognito 用户池的触发器即可在创建用户时获取自定义消息/电子邮件。
This is my SAM code:这是我的 SAM 代码:
AdminCognitoUserPool:
Type: AWS::Cognito::UserPool
Properties:
AutoVerifiedAttributes:
- email
VerificationMessageTemplate:
DefaultEmailOption: CONFIRM_WITH_LINK
Policies:
PasswordPolicy:
MinimumLength: 8
UsernameAttributes:
- email
Schema:
- AttributeDataType: String
Name: email
Required: true
Mutable: true
- AttributeDataType: String
Name: id
# Required: false
Mutable: true
AdminCognitoChangePassword:
Type: AWS::Serverless::Function
Properties:
Handler: src/handlers/config.customCognitoEvents
Role: !GetAtt lambdaRole.Arn
Events:
CognitoEvent:
Type: Cognito
Properties:
UserPool: !Ref AdminCognitoUserPool
Trigger: CustomMessage
The problem was in the globals function environment variables.问题出在全局 function 环境变量中。 I was calling
AdminCognitoUserPool
and thats why the circular dependency was rising.我正在调用
AdminCognitoUserPool
,这就是循环依赖性上升的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.