我正在尝试在无服务器框架中为同一用户池创建多个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"
错误结束。