当前位置: 首页 > 知识库问答 >
问题:

云形成:错误:成员的长度必须小于或等于20

能向晨
2023-03-14

我正在使用这个CloudForm模板创建一个Cognito用户池:

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "Template creates AWS Cognito UserPool.",
    "Resources": {
        "CognitoUserPool": {
            "Type": "AWS::Cognito::UserPool",
            "Properties": {
                "Policies": {
                    "PasswordPolicy": {
                        "MinimumLength": 8,
                        "RequireUppercase": true,
                        "RequireLowercase": true,
                        "RequireNumbers": true,
                        "RequireSymbols": true
                    }
                },
                "Schema": [
                    {
                        "Name": "sub",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": false,
                        "Required": true,
                        "StringAttributeConstraints": {
                            "MinLength": "1",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "name",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "given_name",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "family_name",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "middle_name",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "nickname",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "preferred_username",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "profile",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "picture",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "website",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "email",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": true,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "email_verified",
                        "AttributeDataType": "Boolean",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false
                    },
                    {
                        "Name": "gender",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "birthdate",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "10",
                            "MaxLength": "10"
                        }
                    },
                    {
                        "Name": "zoneinfo",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "locale",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "phone_number",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "phone_number_verified",
                        "AttributeDataType": "Boolean",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false
                    },
                    {
                        "Name": "address",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "updated_at",
                        "AttributeDataType": "Number",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "NumberAttributeConstraints": {
                            "MinValue": "0"
                        }
                    }
                ],
                "LambdaConfig": {},
                "AutoVerifiedAttributes": [
                    "email"
                ],
                "UsernameAttributes": [
                    "email"
                ],
                "SmsVerificationMessage": "Your verification code is {####}. ",
                "EmailVerificationMessage": "Your app verification code is {####}. ",
                "EmailVerificationSubject": "Your app verification code",
                "SmsAuthenticationMessage": "Your authentication code is {####}. ",
                "MfaConfiguration": "OFF",
                "EmailConfiguration": {},
                "UserPoolTags": {},
                "AdminCreateUserConfig": {
                    "AllowAdminCreateUserOnly": false,
                    "UnusedAccountValidityDays": 7,
                    "InviteMessageTemplate": {
                        "SMSMessage": "Your username is {username} and temporary password is {####}. ",
                        "EmailMessage": "Your username is {username} and temporary password is {####}. ",
                        "EmailSubject": "Your temporary password"
                    }
                }         
            }
        }          
    },
    "Outputs": {
        "CognitoUserPoolARN": {
            "Value": {
                "Fn::GetAtt": [
                    "CognitoUserPool",
                    "Arn"
                ]
            },
            "Export": {
                "Name": {
                    "Fn::Sub": "${AWS::StackName}-cognito-userpool-arn"
                }
            }
        }
    }
}

模式是当前和工作用户池的输出:

aws cognito-idp describe-user-pool --user-pool-id POOL_ID

我在创建堆栈(当然使用不同的名称)时出现此错误,即使堆栈有效:

检测到1个验证错误:架构处的值“phone_number_verified”。18.成员.name”未能满足约束:成员的长度必须小于或等于20(服务:AWSCognitoIdentityProviderService;状态代码:400;错误代码:InvalidParameterException;请求ID:ID)

phone_number_verified是布尔值。

共有3个答案

通和裕
2023-03-14

我的错误是,

1 validation error detected: Value 'custom:cognitoIdentityId' at 
'schema.3.member.name' failed to satisfy constraint: .
Member must have length less than or equal to 20 
(Service: AWSCognitoIdentityProviderService; Status Code: 400; 
Error Code: InvalidParameterException; 
Request ID: 2c7c69a9-68ca-4ccc-a951-ab3fa0be2689)

据此,“姓名”属性过长。name属性的值为"CustitoIdtyId"。

根据文件,最小值:1,最大值:20。

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-schemaattribute.html#cfn-cognito用户池模式属性名称

姜弘化
2023-03-14

提示在错误信息中,但我同意这是可怕的误导。它没有提到它指的是哪个成员。对于这个api,它是上面的Schema属性。

您会注意到在模式下有21个属性。由于API一次最多接受20个属性,因此可以删除其中任何一个属性,然后重试。我认为,一旦您使用20个资源进行创建,您应该能够将其添加回去。

濮阳原
2023-03-14

问题是:“电话号码”太长(超过20个字符)。将其更改为类似“phonenumber\u verified”的内容将起作用。

注意:命令aws cloudformation validate不会捕捉到这一点。

 类似资料:
  • 我有一个用电子和节点js编写的应用程序,我正在尝试运行。它使用模块端口扫描器来检查特定范围内的打开端口: 但是,我收到了这个错误: 即使我的范围显然小于65536,大于0。 在线查看,它似乎是节点v6中的错误(我有v6.5.0)。我是nodejs的新手,非常感谢有关如何解决此问题的任何帮助。谢谢。

  • 问题内容: 我在elasticSearch中收到以下错误: [结果窗口太大,从+大小必须小于或等于:[10000],但为[100000]。 请参阅滚动API,以获取请求大型数据集的更有效方法。可以通过更改[index.max_result_window]索引级别参数来设置此限制。我没有进入必须设置的文件 问题答案: 您可以在此处找到一些有关深度分页的官方文档的参考。 如果您需要更新Elastics

  • 问题内容: 嘿,我不断出现错误: 索引(从零开始)必须大于或等于零且小于参数列表的大小。 我的代码: 问题答案: 你的第二个用途是一个占位符,但你只传递一个参数,所以你应该使用来代替。 更改此: 对此:

  • 我一直在尝试学习如何在CPP中的类中声明函数: 这是我写的程序: 有人能说出为什么编译器给出错误“一个非静态成员引用必须是相对于一个特定对象的”。 还有,有人能说出::(作用域解析运算符)和使用.(点运算符)访问类元素之间的区别吗。我有点搞不清这两者之间的区别,谷歌搜索这个区别并没有带来任何匹配的结果。

  • 我写了这段代码。我的输入形状是(100 x100 X3)。我是深度学习的新手。我花了这么多时间在这个问题上,但无法解决这个问题。任何帮助都非常感谢。 错误:在[15]:运行文件('/user/Project/SM/src/ann\u algo\u keras.py',wdir='/user/Project/SM/src')中随机启动突触权重:模型:“sequential\u 3” conv2d_1

  • 问题内容: 在C ++中,我可以定义一个 访问器 成员函数,该函数返回(或引用)私有数据成员的值,以便调用者无法以任何方式修改该私有数据成员。 有没有办法在Java中做到这一点? 如果是这样,怎么办? 我知道关键字但AFAIK应用于 方法 时: 防止在子类中重写/多态化该方法。 使该方法可内联。 (请参见下面@Joachim Sauer的评论) 但这并不限制该方法返回对数据成员的引用,以使调用者无