Open vrajasekhar1 opened 3 months ago
Hello, @vrajasekhar1 👋 and thanks for creating this issue after stopping by our Discord Office Hours. Want to confirm a few things to better understand how the app has been set up so we can get to the root cause of the issue here. Is your support case still ongoing and can you provide the case id # (just in case there's relevant information I can look into)? Also, can you check in the Cognito console to see if you have only 1 App Client ID under Cognito Console > User Pools > Your App's User Pool > App Integration Tab > Scroll to bottom to see the "App Client List"?
Hi Chris, There are two app client IDs in my list. One for app_client and other one for app_clientWeb. The support case that I have created is resolved. The case ID is 172025859400801.
Thanks.
Hi Chris, any further update on this please? This issue is blocking us moving to production. Please let me know if any further info required from my side. Thank you so much for taking care of this issue.
@vrajasekhar1, I haven't been able to reproduce this on my own apps that I've moved from dev to prod. Can you check to see if within your user pool in the Cognito console to see if the SNS phone number is registered with an associated ARN? And on the SNS side of things, is the phone number still showing that it's in "sandbox mode"? Or has the phone number been fully "verified" at this point? Here's a couple of links that could help determine this:
Hi Chris, Thanks for the update.
Moving out of the SMS sandbox This is taken care. Our SNS console says “This account has production access in the Asia Pacific (Mumbai)”
Verify phone numbers for Amazon Cognito in Amazon SNS We did this when we were in SNS sandbox mode and we were able to send messages to verified phone numbers successfully. Since we moved to production, verifying a phone numbers is not required now.
Can you check to see if within your user pool in the Cognito console to see if the SNS phone number is registered with an associated ARN? I do not find an option where SNS phone number is registered with Cognito user pool ARN. Where can I find this option and what SMS phone number we need to provide? In India, we send SMS using a registered Sender ID.
And on the SNS side of things, is the phone number still showing that it's in "sandbox mode"? Or has the phone number been fully "verified" at this point? We verified few phone numbers while in sandbox mode and we were able to send SMS to verified phone numbers.
Following is more detail about what we have in different consoles.
Cognito User pool console: I have set the SNS region correctly I have updated Message Templates as per our approved Templates in DLT
SNS Console: Status says: This account has production access in the Asia Pacific (Mumbai). You can deliver SMS messages to any phone number. Using publish SMS option here, we are able to send SMS message to unverified phone numbers using our registered Entity ID, Sender ID and registered message Template.
AWS End User Messaging Console: Showing list of our registered Sender IDs.
Now my questions / confusions are 1) Amplify Auth/Cognito are failing to recognise though we moved to production? What needs to be done for Cognito to recognise that we moved to production? 2) Cognito user pool console has message templates and End User Messaging Console has list of registered Sender IDs. Where exactly are we mapping message templates to Sender IDs? Without this mapping, how Cognito will know which Sender ID to use while sending message? 3) Without giving Entity ID, we can not send SMS, but I do not find an option to specify Entity ID anywhere. Where exactly Entity ID is maintained? And How Amplify Auth/Cognito uses this info?
Everything seems unclear and there is no proper documentation how Cognito works when we move SNS to production. We have everything handy to send SMS(Registered Entity ID, Sender IDs and Templates) and we are able to send SMS manually using SNS console, but can not send SMS using Amplify Auth/Cognito. Amplify still shows SNS in sandbox mode.
We can show our env in a remote session incase that helps. Please let me know.
Thanks, Rajasekhar.
Hey @vrajasekhar1 :wave: can you share how you have your backend auth resource configured?
Hi @josefaidt, Attached cli-inputs.json from amplify/backend/auth folder, which shows how we configured our Amplify auth backend. cli-inputs.json. Please let me know if any other details required. Thanks.
Hey @vrajasekhar1 thanks for posting that! do you have an override applied to configure Cognito with the SNS resource? https://docs.amplify.aws/gen1/react/build-a-backend/auth/override-cognito/
The override would allow you to conditionally apply the SNS config depending on the env you are deploying to, and exposes the CloudFormation resource being generated by auth. On the user pool resource you can set the SmsConfiguration
property https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-smsconfiguration
Hi @josefaidt We have not applied any override for SNS resources. It's just the default configuration that comes with Amplify.
Just couple of changes we have done in Cognito user pool console are: 1) We have Changed the SNS region associated with our user pool. By default it was set to Asia Pacific (Singapore) and we changed that to Asia Pacific (Mumbai) as our account has production access in Asia Pacific (Mumbai) region. 2) We have changed the format of the verification message to match our message template registered with DLT.
Thanks, Rajasekhar.
@josefaidt Are you saying we will have to override SNS resources to make this work? Does this not work with default configuration provided by Amplify? Can we do a quick remote session so that you can take a look at our env and suggest what steps we can take? Thanks.
Hey @vrajasekhar1 thanks for clarifying! Changes made in the console may be removed on the next push of your resource. This is typically dependent on the type of change and whether the CloudFormation template generated by Amplify that describes the resource configuration has a default value set for this property. To maintain the reference to your SNS resource across subsequent deployments and/or other environments you can override the auth configuration generated by Amplify. By default the SmsConfiguration
is not populated, but can be authored to reference your existing SNS resource using CDK
Hi @josefaidt We have applied override with SmsConfiguration and did amplify push. It has updated SNS region in Cognito console to ap-south-1 as per override configuration. However, no change in the SMS functionality. Amplify Auth SNS mode is still set to sandbox and we still can not send SMS to unverified phone numbers.
Please advise how to move forward on this. Somehow Cognito does not recognise that we have production access in the given region. Please let me know if we can do a quick remote session to resolve this. Thanks.
Hey @vrajasekhar1 is the sandbox mode displaying in the SNS console or the Cognito console?
Hi @josefaidt
Our SNS Console shows: This account has production access in the Asia Pacific (Mumbai). You can deliver SMS messages to any phone number.
However, Amplify Studio console and Cognito console show that we are still in sandbox mode. Attached the screenshots for the same.
Please Note: We have already increased the spending limit in the given AWS region and have registered Sender IDs.
Hey @vrajasekhar1 thanks for clarifying! can you verify whether the originating identity is verified in your SNS console? the configuration looks fine
Hi @josefaidt For India, we use Sender ID as Originator type and we already have registered Sender IDs provisioned in AWS End User Messaging console. Am I missing something?
I guess we are missing something trivial or there is some uncovered bug with Cognito/SNS. A quick remote session of 10-15 mins would really help and saves lot of time. Can we do a quick remote session today if possible? I am available on discord.
Thanks.
Hi @josefaidt , Any update on this bug please? Is there anything I can do to expedite this. Please let me know.
Thanks.
Hey @vrajasekhar1 can you confirm whether the appropriate SnsRegion
is configured in your auth override? https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_SmsConfigurationType.html
For optimal results it is recommended to use the same region as your user pool https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html#sms-choose-a-region
Hi @josefaidt I have already confirmed that correct SnsRegion is configured with auth override. I have also shared the screenshot of Cognito console which shows correct SnsRegion.
Thanks.
Hey @vrajasekhar1 thanks for clarifying. The configuration appears correct. Would you mind reaching out to AWS Support for more insight into the cross-region configuration with Cognito and SNS? https://aws.amazon.com/contact-us/
Hi @josefaidt Could you please share your observations/findings about this bug so far? To my knowledge, we followed all steps as per the documentation and Amplify still does not recognise that SNS is in production mode, isn’t it supposed to be a bug that needs to be fixed?
@vrajasekhar1, our Discord server (where I think you started this conversation/issue from) may be a better route for doing a screenshare or follow up. But were you able to reach out to the AWS Support team on this yet? I think you're spot on that our documentation will only take you so far into getting the SNS account ready for production, and then we rely on/link the Pinpoint docs directly here.
I ask because this may be something that we can't impact much on the Amplify side.
Hi Chris, Initially I started discussing this issue on discard and you asked me to create a bug. However, we could not make much progress on this. Hence we are thinking whether to continue with Amplify or something else.
Please note, we did follow everything as per SNS & Pinpoint documentation and we are able to send SMS using SNS console, but Amplify still shows SNS mode as sandbox and can not send SMS to unverified phone numbers.
Assuming there is a dependency issue with SNS/Pinpoint and Amplify does not work as expected, do you still track the issue with Amplify and ensure issue gets resolved OR you would simply redirect the customers to work with other teams? Just trying to understand the protocol.
@vrajasekhar1, there are some steps in the SNS and Pinpoint setup process that we don't have fully documented on the Amplify side in the event that the Pinpoint documentation or steps change. However, we've heard similar frustrations in the past on getting numbers set up for production when going through this flow. Can you send me a DM on our Discord server so that we can set up a day/time to review this on a call? Don't want you to share any contact information publicly on the Github repo here.
I'll also be marking this issue as a documentation feature request to ensure the docs and process for setting up the SNS account is thorough and reviewed again in full detail.
@cwomack , thanks for checking this. I have sent you a DM on discord. We can connect anytime thats convenient for you.
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
Amplify CLI
Environment information
Describe the bug
We are building a solution with Amplify as backend, where users signup using their mobile number.
Upon signup, Cognito sends a verification code to user’s mobile number and we confirm the signup upon submitting the verification code.
We have setup Amplify backend for this and we are able to send SMS to verified mobile numbers(with SNS mode as Sandbox). Now we wanted to move to production, so that we can send SMS to any phone number.
We created a support case to exit from SMS Sandbox and move to production. Support case has been approved and SNS console shows our account has production access now. However, Amplify Auth still shows SNS mode as Sandbox and we are unable to send SMS to unverified phone numbers.
Please note, we have registered with DLT in India and have valid Entity ID, Sender ID and Template ID. SNS Console clearly shows our account has production access and we are able to successfully send SMS from SNS console to any unverified phone numbers using our Sender ID, but with Amplify we are unable to send SMS.
While publishing SMS using SMS Console, we specify our Entity ID, Sender ID, Template ID and SMS is delivered successfully. With Amplify, where do we specify these values to send SMS and how Cognito would map these values? Programatically all we do is, Auth.signUp(). Cognito User Pool have message Templates and Pinpoint captured Sender IDs, but no idea how/where these Message Templates are mapped to our Entity ID, Sender ID, Template ID. Without this mapping SMS won’t be sent obviously.
It would be good if there is a clear documentation from Amplify how to configure everything(Cognito/SNS/Pinpoint) to make this work. We are literally blocked moving to production on this, though functionality works fine in dev environment and all external aspects with DLT are taken care.
Expected behavior
SNS console clearly shows our account moved to production, but Amplify shows SNS mode as sandbox. Expected behaviour: Amplify should SNS mode as production.
Amplify/Cognito fails to deliver SMS verification code when user signup with mobile number. Expected behaviour: Should deliver SMS using our Entity ID, Sender ID and Template ID.
Amplify documentation is not clear where we need to capture Entity ID, Sender ID, Template ID and how they are mapped/used to send SMS. Expection: Clear documentation from Amplify helps.
Reproduction steps
Create Amplify backend and add auth Auth to have phone number based authentication Users signup and Amplify/Cognito sends SMS verification code Upon submitting the verification code, user account gets confirmed (All of this works in dev env / sandbox mode) Create a support case to exit from Sandbox SNS console shows our account has production access now In SNS console, use Publish SMS to send SMS using our Entity ID, Sender ID and Template ID SMS gets delivered with our Sender ID Now try User signup using Amplify and SMS won’t get delivered
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response