Amazon cloudformation 使用Cognito池更新CloudFormation堆栈声称我们';当我们';你不是

Amazon cloudformation 使用Cognito池更新CloudFormation堆栈声称我们';当我们';你不是,amazon-cloudformation,amazon-cognito,Amazon Cloudformation,Amazon Cognito,从2018年11月7日开始,我们在更新CloudFormation堆栈时开始出现以下错误: Updating user pool schema is not allowed from cloudformation. Use the AddCustomAttributes API or the AWS Cognito Console to update user pool schema. 我们的CF堆栈对Cognito池的自定义属性没有任何更改。它们只更改了后确认和自定义消息触发器,并添加了AP

从2018年11月7日开始,我们在更新CloudFormation堆栈时开始出现以下错误:

Updating user pool schema is not allowed from cloudformation. Use the
AddCustomAttributes API or the AWS Cognito Console to update user pool
schema.
我们的CF堆栈对Cognito池的自定义属性没有任何更改。它们只更改了
后确认
自定义消息
触发器,并添加了API网关响应


有人知道我们为什么会看到这个吗?如何避免此错误消息?

我们在部署时也遇到了同样的问题。目前,我们正在部署它而不使用CustomMessage触发器,并在部署后手动设置CustomMessage触发器。

我们从模板中删除了CustomMessage更改,这似乎起到了作用。

我找到了一个答案,可以自动解决这个问题

我们的脚本过去是如何工作的 首先,让我解释一下这是如何运作的。我曾经拥有以下一组cloudFormation脚本:

cognitoSetup.template  --> <Serverless Framework> --> <cognitoSetup.template updated with triggers>
注意,我们在lambda甚至存在之前设置这个触发器。触发器只需要一个ARN,而且它似乎并不关心它是否还不在那里。然后我们运行
slsdeploy
,创建实际的Lambda函数,一切正常

现在,我们的脚本如下所示:

   "CognitoUserPool": {
     "Type": "AWS::Cognito::UserPool"
     ...
     "Properties": {
     ...
     "LambdaConfig": {
        "CustomMessage": "arn:aws:lambda:<our aws region>:<our account#>:function:main-<our stage>-onCognitoCustomMessage"
      }
    }
cognitoSetup.template  --> <Serverless Framework>
cognitoSetup.template-->

为什么要修复此错误?我真的不知道。CloudFormation似乎可以进行此修改,但在我们的过程中稍后修改同一个文件并不合适。但它是有效的。

不是答案。但我建议您在使用Amazon Cognito的CloudFormation时保持谨慎。有一个已知的deleterecreate bug,正如我们所讨论的,我们已经使用它整整18个月了,从来没有删除过我们的池。我们确保每一个变更都经过一个暂存环境,这样我们就知道它是否被删除了,我想。你们有CICD系统吗?你写了一个程序来重新添加它还是什么?