AWSCognitoIdentityProvider;状态码:400;错误代码:InvalidParameterException:检测到无效的 AttributeDataType
AWSCognitoIdentityProvider; Status Code: 400; Error Code: InvalidParameterException: Cognito Invalid AttributeDataType
我喜欢基于 Java 通过 AWS-CDK 版本 0.24.1 创建一个 Cognito 用户池。在 cdk deploy
期间,我收到错误 InvalidParameterException。
服务: AWSCognitoIdentityProvider;
状态码:400;
错误代码: InvalidParameterException:Cognito 无效的 AttributeDataType 输入,考虑使用提供的 AttributeDataType 枚举
CfnUserPool userPool = new CfnUserPool(this, "cognito",
CfnUserPoolProps.builder()
.withAdminCreateUserConfig(
AdminCreateUserConfigProperty.builder()
.withAllowAdminCreateUserOnly(false)
.build())
.withPolicies(
PoliciesProperty.builder()
.withPasswordPolicy(
PasswordPolicyProperty.builder()
.withMinimumLength(6)
.withRequireLowercase(false)
.withRequireNumbers(false)
.withRequireSymbols(false)
.withRequireUppercase(false)
.build()
)
.build()
)
.withAutoVerifiedAttributes(Arrays.asList("email"))
.withSchema(Arrays.asList("email"))
.build());
也许简单的字符串列表 .withAutoVerifiedAttributes(Arrays.asList("email"))
或 .withSchema(Arrays.asList("email"))
是错误的。但不幸的是,方法签名中只声明了对象列表,没有具体类型:public CfnUserPoolProps.Builder withAutoVerifiedAttributes(@Nullable List value)
.
是否有基于 Java.
使用 aws-cdk 创建类似用户池的示例片段
使用 CfnUserPool.SchemaAttributeProperty.builder()
解决了问题。我认为 SchemaAttributeProperty
是方法 withSchema(@Nullable List< Object > value)
的预期数据类型
CfnUserPool userPool = new CfnUserPool(this, "cognito",
CfnUserPoolProps.builder()
.withAdminCreateUserConfig(
AdminCreateUserConfigProperty.builder()
.withAllowAdminCreateUserOnly(false)
.build())
.withPolicies(
PoliciesProperty.builder()
.withPasswordPolicy(
PasswordPolicyProperty.builder()
.withMinimumLength(6)
.withRequireLowercase(false)
.withRequireNumbers(false)
.withRequireSymbols(false)
.withRequireUppercase(false)
.build()
)
.build()
)
.withAutoVerifiedAttributes(Arrays.asList("email"))
.withSchema(Arrays.asList(
CfnUserPool.SchemaAttributeProperty.builder()
.withAttributeDataType("String")
.withName("email")
.withRequired(true)
.build()))
.build());
我喜欢基于 Java 通过 AWS-CDK 版本 0.24.1 创建一个 Cognito 用户池。在 cdk deploy
期间,我收到错误 InvalidParameterException。
服务: AWSCognitoIdentityProvider;
状态码:400;
错误代码: InvalidParameterException:Cognito 无效的 AttributeDataType 输入,考虑使用提供的 AttributeDataType 枚举
CfnUserPool userPool = new CfnUserPool(this, "cognito",
CfnUserPoolProps.builder()
.withAdminCreateUserConfig(
AdminCreateUserConfigProperty.builder()
.withAllowAdminCreateUserOnly(false)
.build())
.withPolicies(
PoliciesProperty.builder()
.withPasswordPolicy(
PasswordPolicyProperty.builder()
.withMinimumLength(6)
.withRequireLowercase(false)
.withRequireNumbers(false)
.withRequireSymbols(false)
.withRequireUppercase(false)
.build()
)
.build()
)
.withAutoVerifiedAttributes(Arrays.asList("email"))
.withSchema(Arrays.asList("email"))
.build());
也许简单的字符串列表 .withAutoVerifiedAttributes(Arrays.asList("email"))
或 .withSchema(Arrays.asList("email"))
是错误的。但不幸的是,方法签名中只声明了对象列表,没有具体类型:public CfnUserPoolProps.Builder withAutoVerifiedAttributes(@Nullable List value)
.
是否有基于 Java.
使用 aws-cdk 创建类似用户池的示例片段使用 CfnUserPool.SchemaAttributeProperty.builder()
解决了问题。我认为 SchemaAttributeProperty
是方法 withSchema(@Nullable List< Object > value)
CfnUserPool userPool = new CfnUserPool(this, "cognito",
CfnUserPoolProps.builder()
.withAdminCreateUserConfig(
AdminCreateUserConfigProperty.builder()
.withAllowAdminCreateUserOnly(false)
.build())
.withPolicies(
PoliciesProperty.builder()
.withPasswordPolicy(
PasswordPolicyProperty.builder()
.withMinimumLength(6)
.withRequireLowercase(false)
.withRequireNumbers(false)
.withRequireSymbols(false)
.withRequireUppercase(false)
.build()
)
.build()
)
.withAutoVerifiedAttributes(Arrays.asList("email"))
.withSchema(Arrays.asList(
CfnUserPool.SchemaAttributeProperty.builder()
.withAttributeDataType("String")
.withName("email")
.withRequired(true)
.build()))
.build());