amplify-cli: Ampilfy push or build gives me "Invalid AttributeDataType input" error after adding analytics to existing project auth that was building fine
Before opening, please confirm:
- I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
14.17.3
Amplify CLI Version
7.6.5
What operating system are you using?
mac
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, analytics
Amplify Commands
push
Describe the bug
I can’t push changes from amplify cli or deploy code. I am always getting error " Invalid AttributeDataType input, consider using the provided AttributeDataType enum. (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException"
Expected behavior
I should be able to make changes and have my builds complete
Reproduction steps
Added analytics to an already existing project that had auth and api I believe this made some changes to my user pool but not exactly sure what it did. Now I can’t build or push new changes
GraphQL schema(s)
# Put schemas below this line
Log output
# Put your logs below this line
`This will overwrite your current graphql queries, mutations and subscriptions Yes
⠙ Updating resources in the cloud. This may take a few minutes...
UPDATE_IN_PROGRESS amplify-recommendednext-dev-135335 AWS::CloudFormation::Stack Thu Jan 13 2022 12:52:43 GMT-0600 (Central Standard Time) User Initiated
⠏ Updating resources in the cloud. This may take a few minutes...
UPDATE_IN_PROGRESS analyticsrecommendednext AWS::CloudFormation::Stack Thu Jan 13 2022 12:52:49 GMT-0600 (Central Standard Time)
UPDATE_IN_PROGRESS apirecommendednext AWS::CloudFormation::Stack Thu Jan 13 2022 12:52:50 GMT-0600 (Central Standard Time)
UPDATE_IN_PROGRESS authrecommended AWS::CloudFormation::Stack Thu Jan 13 2022 12:52:50 GMT-0600 (Central Standard Time)
UPDATE_COMPLETE analyticsrecommendednext AWS::CloudFormation::Stack Thu Jan 13 2022 12:52:51 GMT-0600 (Central Standard Time)
⠦ Updating resources in the cloud. This may take a few minutes...
UPDATE_IN_PROGRESS amplify-recommendednext-dev-135335-authrecommended-1WZ8ZJT8ZUTMB AWS::CloudFormation::Stack Thu Jan 13 2022 12:52:51 GMT-0600 (Central Standard Time) User Initiated
⠧ Updating resources in the cloud. This may take a few minutes...
UPDATE_IN_PROGRESS amplify-recommendednext-dev-135335-apirecommendednext-IV5UBMFSEAPP AWS::CloudFormation::Stack Thu Jan 13 2022 12:52:50 GMT-0600 (Central Standard Time) User Initiated
⠴ Updating resources in the cloud. This may take a few minutes...
UPDATE_IN_PROGRESS hu Jan 13 2022 12:52:58 GMT-0600 (Central Standard Time)
UPDATE_IN_PROGRESS GraphQLAPITransformerSchema3CB2AE18 AWS::AppSync::GraphQLSchema Thu Jan 13 2022 12:52:58 GMT-0600 (Central Standard Time)
⠏ Updating resources in the cloud. This may take a few minutes...
UPDATE_COMPLETE Thu Jan 13 2022 12:53:00 GMT-0600 (Central Standard Time)
⠸ Updating resources in the cloud. This may take a few minutes...
UPDATE_IN_PROGRESS UserPool AWS::Cognito::UserPool Thu Jan 13 2022 12:53:03 GMT-0600 (Central Standard Time)
⠏ Updating resources in the cloud. This may take a few minutes...
UPDATE_FAILED UserPool AWS::Cognito::UserPool Thu Jan 13 2022 12:53:07 GMT-0600 (Central Standard Time) Invalid AttributeDataType input, consider using the provided AttributeDataType enum. (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID: da231749-bcfb-4c6f-9aaa-80f13849794e; Proxy: null)
UPDATE_ROLLBACK_IN_PROGRESS amplify-recommendednext-dev-135335-authrecommended-1WZ8ZJT8ZUTMB AWS::CloudFormation::Stack Thu Jan 13 2022 12:53:08 GMT-0600 (Central Standard Time) The following resource(s) failed to update: [UserPool].
⠋ Updating resources in the cloud. This may take a few minutes...
UPDATE_FAILED authrecommended AWS::CloudFormation::Stack Thu Jan 13 2022 12:53:13 GMT-0600 (Central Standard Time) Embedded stack arn:aws:cloudformation:us-east-1:606803379457:stack/amplify-recommendednext-dev-135335-authrecommended-1WZ8ZJT8ZUTMB/e88b2a20-724f-11ec-a572-0a85688e4491 was not successfully updated. Currently in UPDATE_ROLLBACK_IN_PROGRESS with reason: The following resource(s) failed to update: [UserPool].
⠦ Updating resources in the cloud. This may take a few minutes...
UPDATE_ROLLBACK_IN_PROGRESS amplify-recommendednext-dev-135335-apirecommendednext-IV5UBMFSEAPP AWS::CloudFormation::Stack Thu Jan 13 2022 12:53:14 GMT-0600 (Central Standard Time) Initiated by parent stack
UPDATE_FAILED GraphQLAPITransformerSchema3CB2AE18 AWS::AppSync::GraphQLSchema Thu Jan 13 2022 12:53:14 GMT-0600 (Central Standard Time) Resource update cancelled
⠹ Updating resources in the cloud. This may take a few minutes...
UPDATE_FAILED apirecommendednext AWS::CloudFormation::Stack Thu Jan 13 2022 12:53:25 GMT-0600 (Central Standard Time) Resource update cancelled
⠙ Updating resources in the cloud. This may take a few minutes...
UPDATE_ROLLBACK_IN_PROGRESS amplify-recommendednext-dev-135335 AWS::CloudFormation::Stack Thu Jan 13 2022 12:53:26 GMT-0600 (Central Standard Time) The following resource(s) failed to update: [apirecommendednext, authrecommended].
⠇ Updating resources in the cloud. This may take a few minutes...
UPDATE_IN_PROGRESS apirecommendednext AWS::CloudFormation::Stack Thu Jan 13 2022 12:53:47 GMT-0600 (Central Standard Time)
UPDATE_IN_PROGRESS analyticsrecommendednext AWS::CloudFormation::Stack Thu Jan 13 2022 12:53:47 GMT-0600 (Central Standard Time)
UPDATE_IN_PROGRESS authrecommended AWS::CloudFormation::Stack Thu Jan 13 2022 12:53:48 GMT-0600 (Central Standard Time)
UPDATE_COMPLETE analyticsrecommendednext AWS::CloudFormation::Stack Thu Jan 13 2022 12:53:48 GMT-0600 (Central Standard Time)
⠼ Updating resources in the cloud. This may take a few minutes...
UPDATE_COMPLETE UserPool AWS::Cognito::UserPool Thu Jan 13 2022 12:54:18 GMT-0600 (Central Standard Time)
UPDATE_IN_PROGRESS GraphQLAPITransformerSchema3CB2AE18 AWS::AppSync::GraphQLSchema Thu Jan 13 2022 12:54:17 GMT-0600 (Central Standard Time)
UPDATE_IN_PROGRESS GraphQLAPIDefaultApiKey215A6DD7 AWS::AppSync::ApiKey Thu Jan 13 2022 12:54:17 GMT-0600 (Central Standard Time)
UPDATE_COMPLETE GraphQLAPIDefaultApiKey215A6DD7 AWS::AppSync::ApiKey Thu Jan 13 2022 12:54:19 GMT-0600 (Central Standard Time)
⠇ Updating resources in the cloud. This may take a few minutes...
UPDATE_COMPLETE apirecommendednext AWS::CloudFormation::Stack Thu Jan 13 2022 12:54:22 GMT-0600 (Central Standard Time)
⠸ Updating resources in the cloud. This may take a few minutes...
UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS amplify-recommendednext-dev-135335-authrecommended-1WZ8ZJT8ZUTMB AWS::CloudFormation::Stack Thu Jan 13 2022 12:54:29 GMT-0600 (Central Standard Time)
⠧ Updating resources in the cloud. This may take a few minutes...
UPDATE_COMPLETE authrecommended AWS::CloudFormation::Stack Thu Jan 13 2022 12:54:35 GMT-0600 (Central Standard Time)
UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS amplify-recommendednext-dev-135335 AWS::CloudFormation::Stack Thu Jan 13 2022 12:54:38 GMT-0600 (Central Standard Time)
⠧ Updating resources in the cloud. This may take a few minutes...
UPDATE_COMPLETE analyticsrecommendednext AWS::CloudFormation::Stack Thu Jan 13 2022 12:54:40 GMT-0600 (Central Standard Time)
⠙ Updating resources in the cloud. This may take a few minutes...
UPDATE_COMPLETE authrecommended AWS::CloudFormation::Stack Thu Jan 13 2022 12:54:50 GMT-0600 (Central Standard Time)
UPDATE_COMPLETE apirecommendednext AWS::CloudFormation::Stack Thu Jan 13 2022 12:54:50 GMT-0600 (Central Standard Time)
UPDATE_ROLLBACK_COMPLETE amplify-recommendednext-dev-135335 AWS::CloudFormation::Stack Thu Jan 13 2022 12:54:50 GMT-0600 (Central Standard Time)
⠦ Updating resources in the cloud. This may take a few minutes...
Following resources failed
Resource Name: us-east-1_90zp5zw6q (AWS::Cognito::UserPool)
Event Type: update
Reason: Invalid AttributeDataType input, consider using the provided AttributeDataType enum. (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID: da231749-bcfb-4c6f-9aaa-80f13849794e; Proxy: null)
URL: https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/arn%3Aaws%3Acloudformation%3Aus-east-1%3A606803379457%3Astack%2Famplify-recommendednext-dev-135335-authrecommended-1WZ8ZJT8ZUTMB%2Fe88b2a20-724f-11ec-a572-0a85688e4491/events
Resource Name: xedizi2s55fctk4dhw2ufv7rwmGraphQLSchema (AWS::AppSync::GraphQLSchema)
Event Type: update
Reason: Resource update cancelled
URL: https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/arn%3Aaws%3Acloudformation%3Aus-east-1%3A606803379457%3Astack%2Famplify-recommendednext-dev-135335-apirecommendednext-IV5UBMFSEAPP%2F3b188f00-7253-11ec-8e7c-0a492b04931b/events
Additional information
exact same issue as https://github.com/aws-amplify/amplify-cli/issues/2309 but it appears this has come back. Also seems like some else is having the same issue but they closed their issue https://github.com/aws-amplify/amplify-cli/issues/9510
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 116 (24 by maintainers)
I am having the same issue
anyone of you with this problem even when the required attributes are in sync? I have a custom attribute added but it worked for months without problems.
I have fixed my issue by following these steps:
check the Required attributes in User Pools
look into cli-inputs.json file “requiredAttributes”: [ “email”, “family_name”, “given_name” ]
remove both “email” and “family_name”
run “amplify push”
redeploy in the console again
done!
@johnpc I’m facing the same issue and it can’t be resolved after downgrading the amplify CLI to v7.6.8 There are some
custom:attributeswere added manually to the Cognito. I can runamplify pushcouple days ago without any problem.I was finally able to get amplify push to work. It appears that it was the same problem with requiredAttributes, but it was presenting itself differently.
Required Attributes in the Cognito Console showed both name and email:
(NOTE: replaced my app id with ‘myapp1234’ in the paths below)
amplify/backend/auth/myapp1234/cli-inputs.json had:
amplify/backend/auth/myapp1234/build/myapp1234-cloudformation-template.json had:
amplify/#current-cloud-backend/auth/myapp1234/cli-inputs.json had:
amplify/#current-cloud-backend/auth/myapp1234/build/myapp1234-cloudformation-template.json had:
So the only incorrect file was the cloudformation-template file in the #current-cloud-backend directory. Everything else appeared correct.
I removed “email” from the amplify/backend/auth/myapp1234/cli-inputs.json file as @johnpc suggested. I then did an amplify push and everything worked. All the above files now show only the name attribute.
Strangely, the Cognito console still shows both “name” and “email”. It does not appear to be causing a problem for me though.
This obviously does not solve the root issue that caused the sync drift, but it got me up and running again after several days of frustration and downtime.
Hopefully this helps everyone else that has this issue.
Hi, I have fixed my issue => Pushing only my auth again have fixed the issue my steps:
Hi team @josefaidt @Straubulous any updates on this issue, my team is blocked for almost two weeks now with this error. I have sent my project my project identification number: 8917f531808b98396e5b186f78b710ba. I have read through the whole discussions and none of the suggestions worked. Thanks
I am also still getting it on 10.4.0. It seems not much is happening on this issue.
Initial fix addressed part of this. Additional documentation to describe high level approach for migration of user pool.
@josefaidt sent a message on discord 👍🏻
Hey @Shomari and folks in the thread 👋 are you still experiencing this issue? There’s quite a few comments here describing the affected workflow and a fix has since gone out for this issue, though I wanted to be sure this was taken care of 🙂
@voyagebagage I believe I may have been in a similar situation as you and I was able to work through it. The following worked for me:
@voyagebagage , check your filesystem. I’m using VSCode for this project, and it hides the #current-cloud-backend folder in the explorer inside VSCode.
@jladdison 's solution above helped me but it’s certainly a strange error. My Cloudformation template all matched except for the one that was being pulled from remote. What’s stranger is that I hadn’t actually done a push on the project in quite some time so I can’t really pinpoint when the
requiredAttributesproperty was updated. In short, nothing had changed until I updated the CLI version. Seems the initial stages. of the push with the new CLI version modified the CF template and dropped all but onerequiredAttribute?So only “picture” is required in your deployed Cognito environment, but your desired configuration is:
The way this looks is, your deployment was bitten by the bug that https://github.com/aws-amplify/amplify-cli/pull/9251 attempted to fix - only one of your required attributes was set in reality. However, since
requiredAttributescannot be edited after the Cognito resource is deployed (a Cognito limitation), it is causing an error where your deployments are failing.I think this makes sense why downgrading is working for so many people. They’re re-pushing with missing requiredAttributes when they downgrade, so the push matches what’s in the cloud. Another “fix” to unblock deploying new changes would be to update
requiredAttributesin your cli-inputs.json to match what’s in the cloud (aka, change it so only “picture” is required")The real long term fix would be to remove your Cognito configuration and replace it with a new one. Of course, you do not want to lose existing user data, so you’d have to migrate your users to a new, properly configured Cognito resource and then import the new auth resource to your app.
Customers in https://github.com/aws-amplify/amplify-cli/issues/9532 are reporting downgrade to CLI v7.6.8 works around this issue
I’m getting this too!