【问题标题】:How to configure multiple Cognito triggers in Serverless framework?如何在无服务器框架中配置多个 Cognito 触发器?
【发布时间】:2019-10-20 20:25:47
【问题描述】:

我正在尝试在无服务器框架中为同一个用户池创建多个 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.",这意味着错误与函数配置的顺序有关(以某种方式相关),因此,配置文件中首先出现的函数工作正常,但另一个一个以"AccessDenied" 错误结束。

【问题讨论】:

    标签: serverless-framework serverless


    【解决方案1】:

    好的,如果其他人遇到同样的问题,this SO 回答对我有帮助。

    【讨论】:

      猜你喜欢
      • 2019-12-15
      • 2020-11-27
      • 1970-01-01
      • 1970-01-01
      • 2018-09-13
      • 1970-01-01
      • 2018-09-18
      • 2020-06-24
      • 2018-11-26
      相关资源
      最近更新 更多