无法创建AW​​S Cognito用户池用户

时间:2017-06-29 16:11:06

标签: amazon-web-services amazon-cognito aws-cognito

我尝试使用 Cognito用户池控制台创建用户(我设置了用户名和临时密码的值),但我一直收到此错误。< / p>

  

属性不符合架构:birthdate:Number必须不超过10个字符(服务:AWSCognitoIdentityProviderService;状态代码:400;错误代码:InvalidParameterException;请求ID:98f3de9e-5ce3-11e7-98e8-9d0c69d31df9)< / p>

用户池是使用无服务器

创建的
Type: AWS::Cognito::UserPool
  DeletionPolicy: Retain
  Properties:
    UserPoolName: employees
    AdminCreateUserConfig:
      AllowAdminCreateUserOnly: true
    Policies:
      PasswordPolicy:
        MinimumLength: 8
        RequireLowercase: true
        RequireNumbers: true
    Schema:
      - Name: "picture"
        AttributeDataType: String
        Mutable: true
        Required: false
      - Name: "given_name"
        AttributeDataType: String
        Mutable: true
        Required: true
      - Name: "middle_name"
        AttributeDataType: String
        Mutable: true
        Required: false
      - Name: "family_name"
        AttributeDataType: String
        Mutable: true
        Required: true
      - Name: "address"
        AttributeDataType: String
        Mutable: true
        Required: false
      - Name: "birthdate"
        AttributeDataType: String
        Mutable: true
        Required: true
      - Name: "gender"
        AttributeDataType: String
        Mutable: true
        Required: true

2 个答案:

答案 0 :(得分:0)

按照您的设置,我可以重现同样的问题。您能否提供您的请求ID的时间戳以及您使用的是哪个地区?

答案 1 :(得分:0)

必须很晚了,但是尝试下面的代码,我定义了MinLength和MaxLength:

Type: AWS::Cognito::UserPool
  DeletionPolicy: Retain
  Properties:
    UserPoolName: employees
    AdminCreateUserConfig:
      AllowAdminCreateUserOnly: true
    Policies:
      PasswordPolicy:
        MinimumLength: 8
        RequireLowercase: true
        RequireNumbers: true
    Schema:
      - Name: "picture"
        AttributeDataType: String
        Mutable: true
        Required: false
      - Name: "given_name"
        AttributeDataType: String
        Mutable: true
        Required: true
      - Name: "middle_name"
        AttributeDataType: String
        Mutable: true
        Required: false
      - Name: "family_name"
        AttributeDataType: String
        Mutable: true
        Required: true
      - Name: "address"
        AttributeDataType: String
        Mutable: true
        Required: false
      - Name: "birthdate"
        AttributeDataType: String
        Mutable: true
        Required: true
        DeveloperOnlyAttribute: false
        StringAttributeConstraints: 
          MinLength: "10"
          MaxLength: "10"
      - Name: "gender"
        AttributeDataType: String
        Mutable: true
        Required: true