我试图在Serverless框架中为同一用户池创建多个Cognito触发器,但是由于某种原因,我无法使其正常工作!
我的功能配置如下
functions:
PreSignUp:
handler: dist/cognito-pre-signup.preSignUp
events:
- cognitoUserPool:
pool: app-user-pool
trigger: PreSignUp
existing: true
PostConfirmation:
handler: dist/cognito-post-confirmation.postConfirmation
events:
- cognitoUserPool:
pool: app-user-pool
trigger: PostConfirmation
existing: true
问题是当我尝试注册时出现错误消息 "PostConfirmation invocation failed due to error AccessDeniedException."
但是真正奇怪的是,如果我交换配置文件中函数的位置,例如
functions:
PostConfirmation:
handler: dist/cognito-post-confirmation.postConfirmation
events:
- cognitoUserPool:
pool: app-user-pool
trigger: PostConfirmation
existing: true
PreSignUp:
handler: dist/cognito-pre-signup.preSignUp
events:
- cognitoUserPool:
pool: app-user-pool
trigger: PreSignUp
existing: true
然后错误消息变为"PreSignUp invocation failed due to error AccessDeniedException."
,这意味着错误与功能config的顺序有关(以某种方式相关),因此,首先出现在config文件中的功能可以正常工作,而另一个最终以"AccessDenied"
错误结束。
好吧,如果其他人也遇到同样的问题,这个答案可以帮助我。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句