Did not receive SMS from Cognito even thought it's a successful request

41 Views Asked by At

I'm unable to receive an SMS from using resendConfirmationCode method from amazon-cognito-identity-js. Even thought the request was sent successfully with a sample response of

{
  AttributeName: "phone_number",
  DeliveryMedium: "SMS",
  Destination: "+*******xxxx"
}

I have the following code that will be called once a user submit a form.

function resendConfirmationCode(username) {
  const cognitoUser = new CognitoUser({
    Username: username,
    Pool: userPool,
  });

  return new Promise((resolve, reject) => {
    cognitoUser.resendConfirmationCode(function (err, result) {
      if (err) reject(err);
      resolve(result);
    });
  });
}

From my perspective, I think my code works well. I have done signUp, and the SMS got sent if the user was new. However, when I used the resendConfirmationCode I got the above response. I have already verified my phone number in Amazon SNS Sandbox. Is there something I missed?

1

There are 1 best solutions below

0
On

So I wasn't reading carefully,

Turns out there's a thing called Account spend limit, you can check it on Amazon SNS > Text Messaging (SMS) > Text messaging preferences.

I'm glad that Amazon put $1 on default. Apparently I have no idea that we're charged for SMS verification. (A bit naive, but Amazon got most the free stuff so I thought that's somewhat free too).

Thanks AWS! This information is hard to find thought. Hopefully this helps.