Amplify-cli: amplify push fails

Created on 13 Dec 2018  ·  27Comments  ·  Source: aws-amplify/amplify-cli

Describe the bug
We follow the tutorial exactly and it results in an error.

To Reproduce
Steps to reproduce the behavior:

  1. npm i -g @aws-amplify/cli
  2. amplify configure
  3. amplify init
  4. amplify add auth
  5. amplify push

Expected behavior
Amplify will be configured without na error.

Screenshots
If applicable, add screenshots to help explain your problem.

$ amplify push
| Category | Resource name   | Operation | Provider plugin   |
| -------- | --------------- | --------- | ----------------- |
| Auth     | cognito73548268 | Create    | awscloudformation |
? Are you sure you want to continue? Yes
⠴ Updating resources in the cloud. This may take a few minutes...

UPDATE_IN_PROGRESS          webv3-20181213091931 AWS::CloudFormation::Stack Thu Dec 13 2018 10:07:33 GMT-0800 (PST) User Initiated                                                                                                                                                                  
CREATE_IN_PROGRESS          authcognito73548268  AWS::CloudFormation::Stack Thu Dec 13 2018 10:07:38 GMT-0800 (PST)                                                                                                                                                                                 
CREATE_FAILED               authcognito73548268  AWS::CloudFormation::Stack Thu Dec 13 2018 10:07:39 GMT-0800 (PST) Template format error: Unrecognized resource types: [AWS::Cognito::UserPool, AWS::Cognito::IdentityPoolRoleAttachment, AWS::Cognito::UserPoolClient, AWS::Cognito::IdentityPool]
UPDATE_ROLLBACK_IN_PROGRESS webv3-20181213091931 AWS::CloudFormation::Stack Thu Dec 13 2018 10:07:40 GMT-0800 (PST) The following resource(s) failed to create: [authcognito73548268].                                                                                                              
⠏ Updating resources in the cloud. This may take a few minutes...Error updating cloudformation stack
✖ An error occurred when pushing the resources to the cloud

Resource is not in the state stackUpdateComplete


UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS webv3-20181213091931 AWS::CloudFormation::Stack Thu Dec 13 2018 10:07:55 GMT-0800 (PST) 
DELETE_COMPLETE                              authcognito73548268  AWS::CloudFormation::Stack Thu Dec 13 2018 10:07:57 GMT-0800 (PST) 
UPDATE_ROLLBACK_COMPLETE                     webv3-20181213091931 AWS::CloudFormation::Stack Thu Dec 13 2018 10:07:57 GMT-0800 (PST) 
investigating

All 27 comments

Could you please point to the exact tutorial that you were following?
when you add auth to your project, what options did you select when prompted?

@UnleashedMind Here's the tutorial: https://aws-amplify.github.io/docs/js/start?ref=amplify-js-btn&platform=purejs

I chose "Yes, use the default configuration."

 Do you want to use the default authentication and security configuration? (Use arrow keys)
❯ Yes, use the default configuration. 
  No, I will set up my own configuration. 
  I want to learn more. 

Any update? We'd like to use Amplify but if the basic installation doesn't work I don't think its a mature enough tool for us. Is this in GA?

Amplify-CLi is in GA.

I was not able to reproduce the issue.
This issue can be cause by your account reaching certain limits or lacking some permissions, let's first try to root cause it.

Log into your aws account, go to CloudFormation console, in the stacks search box, type in 'cognito73548268` or whatever the resource name is, to find the failing stack, click open it and check at which point of its creation it has failed, we can dig out more information from there.

Please also provide these information:

  • amplify-cli version (run amplify -v to get it)
  • the os of your computer

@kylepolich Which region are you trying to push to?

Region can be the cause of the issue too.
Check here for more information.

$ amplify -v
0.1.36

image

image

I'm facing the same issue. In my case it was working fine until I updated the schema today. My region is 'us-east-1' and amplify version is 0.1.35

This happened to me after the CLI failed to create the lambda function to stream dynamoDB to elasticsearch. I think it's safe to say if the amplify push fails for some reason and a rollback is executed, the next amplify push with whatever change to the schema will fail with this error.

I checked with a colleague at another company and they're also having this issue. Has anyone actually been able to get Amplify working at all? Please let us know if you've found a working Quickstart.

@kylepolich
From the stack logs, it looks like the failed operation is not add auth and push, the failure happened at amplify init.
And the reason is that the IAM user that's used to run the amplify init does not have the necessary permission.
You can follow these steps to get it to work:

  • Execute amplify configure and follow the steps to setup a new IAM user, choose the default 'AdministratorAccess' permission will ensure no such problem will occur again, we are working to have more granular permission settings. Save the newly created user in a named profile (such as 'default')
  • Execute amplify init and choose the newly created profile when prompted.

@krishnaanaril @npradeeptha
Thanks for the feedbacks, your problems seem to be different than what @kylepolich has reported here.
Could you guys please log your own separated issues so we can better assist you to get them resolved?

@UnleashedMind I repeated those steps and both completed with no errors or warnings of any kind. My problem only occurs during amplify push, when I get this:

$ amplify push
| Category | Resource name   | Operation | Provider plugin   |
| -------- | --------------- | --------- | ----------------- |
| Auth     | cognito33d3a96b | Create    | awscloudformation |
? Are you sure you want to continue? Yes
⠇ Updating resources in the cloud. This may take a few minutes...

UPDATE_IN_PROGRESS          webv3-20181217222047 AWS::CloudFormation::Stack Mon Dec 17 2018 22:21:58 GMT-0800 (PST) User Initiated                                                                                                                                                                  
CREATE_IN_PROGRESS          authcognito33d3a96b  AWS::CloudFormation::Stack Mon Dec 17 2018 22:22:03 GMT-0800 (PST)                                                                                                                                                                                 
CREATE_FAILED               authcognito33d3a96b  AWS::CloudFormation::Stack Mon Dec 17 2018 22:22:04 GMT-0800 (PST) Template format error: Unrecognized resource types: [AWS::Cognito::UserPool, AWS::Cognito::IdentityPoolRoleAttachment, AWS::Cognito::UserPoolClient, AWS::Cognito::IdentityPool]
UPDATE_ROLLBACK_IN_PROGRESS webv3-20181217222047 AWS::CloudFormation::Stack Mon Dec 17 2018 22:22:05 GMT-0800 (PST) The following resource(s) failed to create: [authcognito33d3a96b].                                                                                                              
⠇ Updating resources in the cloud. This may take a few minutes...

UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS webv3-20181217222047 AWS::CloudFormation::Stack Mon Dec 17 2018 22:22:15 GMT-0800 (PST) 
DELETE_COMPLETE                              authcognito33d3a96b  AWS::CloudFormation::Stack Mon Dec 17 2018 22:22:16 GMT-0800 (PST) 
UPDATE_ROLLBACK_COMPLETE                     webv3-20181217222047 AWS::CloudFormation::Stack Mon Dec 17 2018 22:22:16 GMT-0800 (PST) 
⠦ Updating resources in the cloud. This may take a few minutes...Error updating cloudformation stack
✖ An error occurred when pushing the resources to the cloud

Resource is not in the state stackUpdateComplete

@kylepolich
From the terminal screenshot, the creation of the resource cognito33d3a96b failed, then it should be shown in the CloudFormation console, the Logical ID for that would be authcognito33d3a96b.
It'd be very helpful if you can open the two stackswebv3-20181217222047 and webv3-20181217222047-authcognito33d3a96b-xxxxx (xxxxx being some random string), in the CloudFormation console and give us more details.

Please tell us what _region_ you created those resources, you can see the region in the upper right corner of the CloudFormation console.

The CloudFormation console screen shot you posted above (4 days ago) does not show the auth cognito resource, in stead it shows the failure to create the Auth and UnAuth roles, which happens during the execution of amplify init, and that failure was caused by the the aws credential configured for the cli does not have a permission, which can be resolved if you configure it with the appropriate permissions (see the instructions I posted in the previous comment above).

@kylepolich Looks like you're trying to deploy in a region which is not supported by Cognito.
Which region are you trying to deploy to?

@kaustavghosh06 us-east-1

How can I know what regions are not allowed. We did everything else on us-east-1. It will be a lot of work to move everything. Do you know when support will be added?

@kylepolich Cognito should be supported in us-east-1. Are you still getting the error when pushing?

@kaustavghosh06, yes, we still cannot push. We tried using IAM profile with full access but it didn't help

I can also mirror this issue. I have just completed an install following the init steps and pushing seemingly adding auth throws the error. I am in the process of deleting and starting again.

Resource is not in the state stackUpdateComplete

Same error again. Looking seems this issue has been around for a while. Unfortunate as it was looking very promising

@frakay100 Could you please paste your Cloudformation stack trace out here? That’ll be helpful for us to debug.

I run to the same error as well here my log

UPDATE_IN_PROGRESS          cookly-ios-client-20190212160346 AWS::CloudFormation::Stack Tue Feb 12 2019 16:57:58 GMT+0700 (Indochina Time) User Initiated
CREATE_IN_PROGRESS          authCooklyAuth                   AWS::CloudFormation::Stack Tue Feb 12 2019 16:58:04 GMT+0700 (Indochina Time)
CREATE_FAILED               authCooklyAuth                   AWS::CloudFormation::Stack Tue Feb 12 2019 16:58:05 GMT+0700 (Indochina Time) Template format error: YAML not well-formed. (line 383, column 62)
UPDATE_ROLLBACK_IN_PROGRESS cookly-ios-client-20190212160346 AWS::CloudFormation::Stack Tue Feb 12 2019 16:58:05 GMT+0700 (Indochina Time) The following resource(s) failed to create: [authCooklyAuth].
⠇ Updating resources in the cloud. This may take a few minutes...

UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS cookly-ios-client-20190212160346 AWS::CloudFormation::Stack Tue Feb 12 2019 16:58:11 GMT+0700 (Indochina Time)
DELETE_COMPLETE                              authCooklyAuth                   AWS::CloudFormation::Stack Tue Feb 12 2019 16:58:12 GMT+0700 (Indochina Time)
UPDATE_ROLLBACK_COMPLETE                     cookly-ios-client-20190212160346 AWS::CloudFormation::Stack Tue Feb 12 2019 16:58:13 GMT+0700 (Indochina Time)
⠹ Updating resources in the cloud. This may take a few minutes...Error updating cloudformation stack
✖ An error occurred when pushing the resources to the cloud

Resource is not in the state stackUpdateComplete

amplify version: 1.1.0

@kraisorns Could you please let me the steps you used to add auth? I'm trying to reproducing this issue with the "Default configurations" option and not able to.

Same here :(

Got all the latest everything as of 26/02/2019 but still getting this:

> amplify update auth
Please note that certain attributes may not be overwritten if you choose to use defaults settings.
Using service: Cognito, provided by: awscloudformation
 The current configured provider is Amazon Cognito.
 Do you want to use the default authentication and security configuration? No, I will set up my own configuration.
? Select the authentication/authorization services that you want to use: User Sign-Up, Sign-In, connected with AWS IAM controls (Enables per-user Storage features for images or other content, Analytics, and more)
? Allow unauthenticated logins? (Provides scoped down permissions that you can control via AWS IAM) Yes
? Do you want to enable 3rd party authentication providers in your identity pool? Yes
? Select the 3rd party authentication providers that you want to enable:  Google

 You've opted to allow users to authenticate via Google.  If you haven't already, you'll need to go to https://developers.google.com/identity and create an App ID.
 Enter your Google Web Client ID:  xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com
? Multifactor authentication (MFA) user login options: OFF
? Email based user registration/forgot password: Disabled (Uses SMS/TOTP as an alternative)
? Please specify an SMS verification message: Your verification code is {####}
? Do you want to override the default password policy for this User Pool? No
? Specify the app's refresh token expiration period (in days): 30
? Do you want to specify the user attributes this app can read and write? No
Successfully updated resource cognito3a05b273 locally

Some next steps:
"amplify push" will build all your local backend resources and provision it in the cloud
"amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud


> amplify push

Current Environment: dev

| Category | Resource name   | Operation | Provider plugin   |
| -------- | --------------- | --------- | ----------------- |
| Auth     | cognito3a05b273 | Update    | awscloudformation |
? Are you sure you want to continue? Yes
- Updating resources in the cloud. This may take a few minutes...

UPDATE_IN_PROGRESS          androidcognito-20190225135902 AWS::CloudFormation::Stack Tue Feb 26 2019 08:51:09 GMT+1300 (New Zealand Daylight Time) User Initiated
UPDATE_IN_PROGRESS          authcognito3a05b273           AWS::CloudFormation::Stack Tue Feb 26 2019 08:51:15 GMT+1300 (New Zealand Daylight Time)
UPDATE_FAILED               authcognito3a05b273           AWS::CloudFormation::Stack Tue Feb 26 2019 08:51:15 GMT+1300 (New Zealand Daylight Time) Template format error: YAML not well-formed. (line 358, column 62)
UPDATE_ROLLBACK_IN_PROGRESS androidcognito-20190225135902 AWS::CloudFormation::Stack Tue Feb 26 2019 08:51:16 GMT+1300 (New Zealand Daylight Time) The following resource(s) failed to update: [authcognito3a05b273].
- Updating resources in the cloud. This may take a few minutes...

UPDATE_COMPLETE                              authcognito3a05b273           AWS::CloudFormation::Stack Tue Feb 26 2019 08:51:38 GMT+1300 (New Zealand Daylight Time)
UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS androidcognito-20190225135902 AWS::CloudFormation::Stack Tue Feb 26 2019 08:51:39 GMT+1300 (New Zealand Daylight Time)
UPDATE_IN_PROGRESS                           authcognito3a05b273           AWS::CloudFormation::Stack Tue Feb 26 2019 08:51:40 GMT+1300 (New Zealand Daylight Time)
UPDATE_COMPLETE                              authcognito3a05b273           AWS::CloudFormation::Stack Tue Feb 26 2019 08:51:41 GMT+1300 (New Zealand Daylight Time)
UPDATE_ROLLBACK_COMPLETE                     androidcognito-20190225135902 AWS::CloudFormation::Stack Tue Feb 26 2019 08:51:41 GMT+1300 (New Zealand Daylight Time)
| Updating resources in the cloud. This may take a few minutes...Error updating cloudformation stack
× An error occurred when pushing the resources to the cloud

Resource is not in the state stackUpdateComplete

PS: this is why I use terraform or pulumi whenever I can - cloudformation is just so unstable and unreliable

@BerndWessels @kraisorns Your issues should be fixed with the latest version of the CLI.
Also, please feel free to re-open this issue if you're still seeing problems with the latest version.

I have faced the same issue and it was caused by changing the project's route or name. To solve it open amplify/.config/project-config.json and check projectPath

Same issue here:

Template format error: Unrecognized resource types: [AWS::Cognito::UserPool, AWS::Cognito::IdentityPoolRoleAttachment, AWS::Cognito::UserPoolClient, AWS::Cognito::IdentityPool]

Is this because Cognito is not supported in use-west-1 ?

Was this page helpful?
0 / 5 - 0 ratings