Closed Phobarp closed 2 years ago
Hey @Phobarp :wave: thanks for raising this! From your project I see this usernameAttributes
value that stands out to me
"usernameAttributes": [
"email, phone_number"
],
From git, are you able to see what this value was set to previously?
Hey @josefaidt! usernameAttributes
was previously also set to email
and phone_number
Hey @Phobarp thanks for clarifying, were they previously shown as separate attributes?
"usernameAttributes": [
"email" , "phone_number"
],
They were previously set as one attribute as well, this remains unchanged:
"usernameAttributes": [
"email, phone_number"
],
Hmm, would you mind posting the diff of this file before/after migrating?
Yes of course, and just to be clear, we are talking about the .../amplify/backend/auth/resourceName/parameters.json before and .../amplify/backend/auth/resourceName/build/parameters.json after correct?
before migrating it will be parameters.json
and after it will be cli-inputs.json
Here are the files (Took out the name attributes):
parameters.json
before:
{
...,
"allowUnauthenticatedIdentities": false,
"autoVerifiedAttributes": ["email"],
"mfaConfiguration": "OFF",
"mfaTypes": ["SMS Text Message"],
"smsAuthenticationMessage": "Your authentication code is {####}",
"smsVerificationMessage": "Your verification code is {####}",
"emailVerificationSubject": "Your verification code",
"emailVerificationMessage": "Your verification code is {####}",
"defaultPasswordPolicy": false,
"passwordPolicyMinLength": 8,
"passwordPolicyCharacters": [],
"requiredAttributes": [],
"userpoolClientGenerateSecret": false,
"userpoolClientRefreshTokenValidity": 30,
"userpoolClientWriteAttributes": ["email"],
"userpoolClientReadAttributes": ["email"],
"userpoolClientSetAttributes": false,
"sharedId": "7a629ee5",
"authSelections": "identityPoolAndUserPool",
"authRoleArn": {
"Fn::GetAtt": ["AuthRole", "Arn"]
},
"unauthRoleArn": {
"Fn::GetAtt": ["UnauthRole", "Arn"]
},
"useDefault": "default",
"usernameAttributes": ["email, phone_number"],
"triggers": "{}",
"userPoolGroupList": [],
"serviceName": "Cognito",
"usernameCaseSensitive": false,
"parentStack": {
"Ref": "AWS::StackId"
},
"breakCircularDependency": true,
"permissions": [],
"dependsOn": []
}
cli-inputs.json
after:
{
"version": "1",
"cognitoConfig": {
"allowUnauthenticatedIdentities": false,
"autoVerifiedAttributes": [
"email"
],
"mfaConfiguration": "OFF",
"mfaTypes": [
"SMS Text Message"
],
"smsAuthenticationMessage": "Your authentication code is {####}",
"smsVerificationMessage": "Your verification code is {####}",
"emailVerificationSubject": "Your verification code",
"emailVerificationMessage": "Your verification code is {####}",
"defaultPasswordPolicy": false,
"passwordPolicyMinLength": 8,
"passwordPolicyCharacters": [],
"requiredAttributes": [],
"aliasAttributes": [],
"userpoolClientGenerateSecret": false,
"userpoolClientRefreshTokenValidity": 30,
"userpoolClientWriteAttributes": [
"email"
],
"userpoolClientReadAttributes": [
"email"
],
"userpoolClientSetAttributes": false,
"authSelections": "identityPoolAndUserPool",
"serviceName": "Cognito",
"useDefault": "defaultSocial",
"sharedId": "7a629ee5",
"userPoolGroupList": [],
"usernameAttributes": [
"email, phone_number"
],
"usernameCaseSensitive": false,
"triggers": {},
"authRoleArn": {
"Fn::GetAtt": [
"AuthRole",
"Arn"
]
},
"unauthRoleArn": {
"Fn::GetAtt": [
"UnauthRole",
"Arn"
]
},
"breakCircularDependency": true,
"useEnabledMfas": false,
"dependsOn": [],
"hostedUI": true,
"authProvidersUserPool": [
"Facebook",
"Google"
],
"hostedUIProviderMeta": "[{\"ProviderName\":\"Facebook\",\"authorize_scopes\":\"public_profile\",\"AttributeMapping\":{\"username\":\"id\"}},{\"ProviderName\":\"Google\",\"authorize_scopes\":\"openid profile\",\"AttributeMapping\":{\"username\":\"sub\"}}]",
"oAuthMetadata": "{\"AllowedOAuthFlows\":[\"code\"],\"AllowedOAuthScopes\":[\"phone\",\"email\",\"openid\",\"profile\",\"aws.cognito.signin.user.admin\"],\"CallbackURLs\":[\"http://localhost:3000/\"],\"LogoutURLs\":[\"http://localhost:3000/\"]}",
"authProviders": [],
"parentStack": {
"Ref": "AWS::StackId"
},
"permissions": []
}
}
Hi @Phobarp
Can you check the userNameConfiguration
attribute value in your cognito console ?
If the value if enabled on that , You can try removing the usernameCaseSensitive
flag from cli-inputs.json
and try amplify push
again ?
Let me know if that works for you ?
Hey @akshbhu, thank you so much for the suggestion! After removing the usernameCaseSensitive
flag from the cli-inputs.json, I used amplify push successfully! However, why was I getting this error in the first place, as all I did was add Google and Facebook as social providers?
Hi @Phobarp
Nice to know it worked for you. Have you checked the userNameConfiguration
in your Cognito Console ?
I believe your UserNameConfiguration
on cloud might be set to true and userNamecaseSensitive
flag is set to false which was causing the problem
The part I am not sure is how it went to false in the parameters.json and cli-inputs after migration ?
Hey @akshbhu Are you referring to this checkbox in the attributes section of general settings, this checkbox was unchecked before and after the push?
Hey @Phobarp apologies for the delay here, are you still experiencing this issue?
From where the thread left off it appears you were able to push successfully after removing userNamecaseSensitive
from your auth resource's cli-inputs.json
, however what remains unresolved is how this was being detected as a change to the configuration where you're seeing case sensitive. If you run a "drift detection" on your application's stack in the AWS CloudFormation console, do you see any results for the Cognito resource that stand out?
Hey @josefaidt, I was able to push successfully after removing userNamecaseSensitive
from my auth resource's cli-inputs.json. I will close this issue now.
Before opening, please confirm:
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v16.16.0
Amplify CLI Version
9.2.0
What operating system are you using?
Windows
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
Amplify Categories
auth
Amplify Commands
push, update
Describe the bug
I am attempting to add Google and Facebook as social providers to an existing userpool using AWS Amplify. After using amplify update auth, applying default configuration with social provider, and inputting the specific App ID's I am getting the following error when I use
amplify push:
Expected behavior
I expected changes to push without any issues
Reproduction steps
After adding auth to amplify without social providers and pushing the changes:
amplify update auth
amplify push
, I received the errorGraphQL schema(s)
Project Identifier
1c94f676c0a86ca6076c9de8ec67190e
Log output
Additional information
No response