Amplify-cli: Failed to build exists project on Amplify Console

Created on 26 Dec 2019  路  13Comments  路  Source: aws-amplify/amplify-cli

Note: If your issue/bug is regarding the AWS Amplify Console service, please log it in the
Amplify Console GitHub Issue Tracker

Describe the bug
Failed to build exists project on Amplify Console.

2019-12-26T01:48:49.104Z [INFO]: # Executing command: amplifyPush --simple
2019-12-26T01:48:49.613Z [INFO]: 
2019-12-26T01:48:49.614Z [INFO]: The nodejs runtime are updated successfully in the CloudFormation templates.
2019-12-26T01:48:49.614Z [INFO]: Make sure the template changes are pushed to the cloud by "amplify push"
2019-12-26T01:48:52.179Z [INFO]: 
2019-12-26T01:48:52.181Z [INFO]: For more information on AWS Profiles, see:
                                 https://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html
2019-12-26T01:48:52.814Z [INFO]: Amplify AppID found: xxxxxx. Amplify App name is: appname}
2019-12-26T01:48:52.944Z [INFO]: Backend environment dev found in Amplify Console app: appname
2019-12-26T01:48:58.835Z [INFO]: 
2019-12-26T01:49:00.371Z [INFO]: Note: It is recommended to run this command from the root of your app directory
2019-12-26T01:49:03.251Z [INFO]: Amplify AppID found: xxxxxx. Amplify App name is: appname}
2019-12-26T01:49:03.348Z [INFO]: Adding backend environment dev to AWS Amplify Console app: xxxxxx
2019-12-26T01:49:03.485Z [INFO]: init failed
2019-12-26T01:49:03.487Z [INFO]: { BadRequestException: BackendEnvironment dev already exists.
                                 at Object.extractError (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/protocol/json.js:51:27)
                                 at Request.extractError (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/protocol/rest_json.js:55:8)
                                 at Request.callListeners (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
                                 at Request.emit (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
                                 at Request.emit (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:683:14)
                                 at Request.transition (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)
                                 at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)
                                 at /root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10
                                 at Request.<anonymous> (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)
                                 at Request.<anonymous> (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:685:12)
                                 message: 'BackendEnvironment dev already exists.',
                                 code: 'BadRequestException',
                                 time: 2019-12-26T01:49:03.484Z,
                                 requestId: '98e4b3f0-ba1e-4714-9b17-77ed6efcb9ed',
                                 statusCode: 400,
                                 retryable: false,
                                 retryDelay: 43.165503472112455 }

Amplify CLI Version
4.8.0

To Reproduce
execute amplify init with [email protected]

Expected behavior
A clear and concise description of what you expected to happen.

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

Desktop (please complete the following information):

  • OS: Linux
  • Node Version: v12.13.1

Additional context
https://github.com/aws-amplify/amplify-cli/blob/80a8733c3ca4c273ce89b0e571d9bbd8c0b0fd3f/packages/amplify-provider-awscloudformation/lib/amplify-service-migrate.js#L61

envName variable is string. But, element of backendEvns array is object, it is not string.
This condition of if statement is always false.

bug pending-release platform

Most helpful comment

I just want to live in a world where the CLI doesn't make me want to cry at 3am

All 13 comments

This also exists on CLI 4.7.0

I'm seeing the same exact issue

I just want to live in a world where the CLI doesn't make me want to cry at 3am

Also seeing this issue. Tried rebuilding my current project 3 times today before I figured out that others were having the issue too. Happens when I try building a simple helloworld application too.

Faced the same issue today https://github.com/aws-amplify/amplify-console/issues/339

Project works fine on 4.7.0 and fails on 4.8.0 - updating environment variable _LIVE_UPDATES on Amplify Console from [{"name":"Amplify CLI","pkg":"@aws-amplify/cli","type":"npm","version":"latest"}] to [{"name":"Amplify CLI","pkg":"@aws-amplify/cli","type":"npm","version":"4.7.0"}] fixes the issue for me.

image

The new version 4.9.0 should have fixed the bug. please test and confirm.

I tested new version 4.9.0. If AmplifyAppId is already present in the team provider info, build is successful. But, if AmplifyAppId is not present, build is failed.

No issue with version 4.9.0. My app was not a new one, it was already deployed into amplify.

@UnleashedMind works for me with existing project

Build fails for me (new environment) with the following error:

Initiated
                                 UPDATE_IN_PROGRESS authfrontend4aa7fb914aa7fb91  AWS::CloudFormation::Stack Fri Dec 27 2019 14:38:39 GMT+0000 (Coordinated Universal Time)
2019-12-27T14:38:44.787Z [INFO]: 
2019-12-27T14:38:44.793Z [INFO]: UPDATE_FAILED               authfrontend4aa7fb914aa7fb91  AWS::CloudFormation::Stack Fri Dec 27 2019 14:38:39 GMT+0000 (Coordinated Universal Time) Parameters: [authRoleArn, autoVerifiedAttributes, allowUnauthenticatedIdentities, hostedUI, smsVerificationMessage, userpoolClientReadAttributes, mfaTypes, emailVerificationSubject, useDefault, userpoolClientGenerateSecret, mfaConfiguration, identityPoolName, thirdPartyAuth, userPoolGroupList, authSelections, adminQueries, permissions, resourceNameTruncated, userPoolGroups, smsAuthenticationMessage, passwordPolicyMinLength, userPoolName, userpoolClientWriteAttributes, dependsOn, parentStack, resourceName, triggers, emailVerificationMessage, userpoolClientRefreshTokenValidity, userpoolClientSetAttributes, unauthRoleArn, requiredAttributes, passwordPolicyCharacters, userpoolClientLambdaRole, defaultPasswordPolicy] must have values
                                 UPDATE_ROLLBACK_IN_PROGRESS amplify-frontend-integ-221518 AWS::CloudFormation::Stack Fri Dec 27 2019 14:38:40 GMT+0000 (Coordinated Universal Time) The following resource(s) failed to update: [authfrontend4aa7fb914aa7fb91].

@UnleashedMind

Could you share the error message?

For me it's what I posted above: UPDATE_FAILED authfrontend4aa7fb914aa7fb91 AWS::CloudFormation::Stack Fri Dec 27 2019 14:38:39 GMT+0000 (Coordinated Universal Time) Parameters: [authRoleArn, autoVerifiedAttributes, allowUnauthenticatedIdentities, hostedUI, smsVerificationMessage, userpoolClientReadAttributes, mfaTypes, emailVerificationSubject, useDefault, userpoolClientGenerateSecret, mfaConfiguration, identityPoolName, thirdPartyAuth, userPoolGroupList, authSelections, adminQueries, permissions, resourceNameTruncated, userPoolGroups, smsAuthenticationMessage, passwordPolicyMinLength, userPoolName, userpoolClientWriteAttributes, dependsOn, parentStack, resourceName, triggers, emailVerificationMessage, userpoolClientRefreshTokenValidity, userpoolClientSetAttributes, unauthRoleArn, requiredAttributes, passwordPolicyCharacters, userpoolClientLambdaRole, defaultPasswordPolicy] must have values

The fix for the original issue has been pushed (v4.9).

@evah88 Your issue seems to be different, could you please open up another issue for this specific auth related issue?

Was this page helpful?
0 / 5 - 0 ratings