Vignesh S
Vignesh S

Reputation: 429

AWS Cognito sign up error

I tried signing-up for an android application using AWS cognito. But, whenever I did, it showed:

Sign-up failed - 1 validation error detected: value null at userattributes.1.member.name failed to satisfy constraint: member must not be null

  1. How to fix this?
  2. Where's the source of this error message in AWS?

Upvotes: 1

Views: 2274

Answers (2)

Orchis
Orchis

Reputation: 533

I encountered this problem and found it was a problem with case of the 'Name' and 'Value' keys in the object I was passing to the constructor for AdminCreateUserCommand (I'm using the JS SDK v3, but maybe this is relevant to all version of the AWS SDK).

i.e. instead of this code, which gave me the error in your question:

const command = new AdminCreateUserCommand({
    Username: email,
    UserPoolId: "my-user-pool-id",
    DesiredDeliveryMediums: ["EMAIL"],
    UserAttributes: [
        { name: "email", value: email },
        { name: "email_verified", value: true },
    ],
});

This worked:

const command = new AdminCreateUserCommand({
    Username: email,
    UserPoolId: "my-user-pool-id",
    DesiredDeliveryMediums: ["EMAIL"],
    UserAttributes: [
        { Name: "email", Value: email },
        { Name: "email_verified", Value: "True" },
    ],
});

Note the capitalisation of the keys in the UserAttributes object, and the use of "True" instead of true.

Upvotes: 4

Jeff Bailey
Jeff Bailey

Reputation: 5775

When you're signing up the user, it looks like the attributes you're passing are incomplete. Specifically, name seems to be partially null. Give that a look.

Upvotes: 0

Related Questions