amplify-cli: "Stack [...] already exists, please report this issue to amplify-cli github" error and amplify console build timeout

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.
  • I have removed any sensitive information from my code snippets and submission.

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

14

Amplify CLI Version

10.2.2

What operating system are you using?

Amazonlinux

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

no

Amplify Categories

Not applicable

Amplify Commands

init

Describe the bug

In amplify-console, since Oct. 3, we have repeatedly been getting build timeouts and the following error:

[31mAn error occurred when creating the CloudFormation stack 2022-10-05T20:46:14.908Z [INFO]: 🛑 Stack [amplify-ess-app-abdulladev-215910] already exists 2022-10-05T20:46:14.908Z [INFO]: Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the project identifier from: ‘amplify diagnose --send-report’

In my local workstation I’m able to do an amplify push with no issues, although I have not tested ‘amplify init’. I created https://github.com/aws-amplify/amplify-hosting/issues/3017 since this seems to be amplify-console issue but I have no response so far.

Since the logs are telling me to send this report to you and file an issue I’m doing so here. My project identifier (when I run amplify diagnose in my local workstation) is 3def1a2bd59d61900f734d59f169a578.

Expected behavior

Backend build should complete successfully, and if there is error it should fail immediately rather than waiting 30 min and timing out.

Reproduction steps

Do any deployment in amplify console env d2d6ty1wlg8jch

GraphQL schema(s)

# Put schemas below this line


Project Identifier

3def1a2bd59d61900f734d59f169a578

Log output

# Put your logs below this line
2022-10-05T20:46:12.838Z [WARNING]: Everything up-to-date
2022-10-05T20:46:12.844Z [INFO]: # Getting Amplify CLI Cloud-Formation stack info from environment cache
2022-10-05T20:46:12.851Z [INFO]: # Start initializing Amplify environment: abdulladev
                                 # Initializing new Amplify environment: abdulladev (amplify init)
2022-10-05T20:46:14.076Z [INFO]: Note: It is recommended to run this command from the root of your app directory
2022-10-05T20:46:14.791Z [INFO]: Amplify AppID found: d2d6ty1wlg8jch. Amplify App name is: ess-app
2022-10-05T20:46:14.904Z [INFO]: 
                                 An error occurred when creating the CloudFormation stack
2022-10-05T20:46:14.908Z [INFO]: 🛑 Stack [amplify-ess-app-abdulladev-215910] already exists
2022-10-05T20:46:14.908Z [INFO]: Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the project identifier from: 'amplify diagnose --send-report'
2022-10-05T21:15:16.557Z [INFO]: ExpiredToken: The security token included in the request is expired
                                 at Request.extractError (/snapshot/repo/build/node_modules/aws-sdk/lib/protocol/query.js:50:29)
                                 at Request.callListeners (/snapshot/repo/build/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
                                 at Request.emit (/snapshot/repo/build/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
                                 at Request.emit (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:686:14)
                                 at Request.transition (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:22:10)
                                 at AcceptorStateMachine.runTo (/snapshot/repo/build/node_modules/aws-sdk/lib/state_machine.js:14:12)
                                 at /snapshot/repo/build/node_modules/aws-sdk/lib/state_machine.js:26:10
                                 at Request.<anonymous> (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:38:9)
                                 at Request.<anonymous> (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:688:12)
                                 at Request.callListeners (/snapshot/repo/build/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
                                 at Request.emit (/snapshot/repo/build/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
                                 at Request.emit (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:686:14)
                                 at Request.transition (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:22:10)
                                 at AcceptorStateMachine.runTo (/snapshot/repo/build/node_modules/aws-sdk/lib/state_machine.js:14:12)
                                 at /snapshot/repo/build/node_modules/aws-sdk/lib/state_machine.js:26:10
                                 at Request.<anonymous> (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:38:9)
                                 at Request.<anonymous> (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:688:12)
                                 at Request.callListeners (/snapshot/repo/build/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
                                 at callNextListener (/snapshot/repo/build/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
                                 at IncomingMessage.onEnd (/snapshot/repo/build/node_modules/aws-sdk/lib/event_listeners.js:335:13)
                                 at IncomingMessage.emit (events.js:412:35)
                                 at IncomingMessage.emit (domain.js:475:12)
                                 at endReadableNT (internal/streams/readable.js:1334:12)
                                 at processTicksAndRejections (internal/process/task_queues.js:82:21) {
                                 code: 'ExpiredToken',
                                 time: 2022-10-05T21:15:16.554Z,
                                 requestId: '6bdc832a-e716-48b2-b468-2c5e68751cb1',
                                 statusCode: 403,
                                 retryable: true
                                 }

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

Hey folks using CLI v10.2.1 I cloned an existing project from git, attempted a headless init, and was able to reproduce this issue. After switching to pull, however, I was able to successfully pull the project and initialize it locally.

➜  amplify init --envName next --yes
Note: It is recommended to run this command from the root of your app directory
Using default provider  awscloudformation

Deploying resources into next environment. This will take a few minutes. ⠙
Deploying root stack 9071 [ ---------------------------------------- ] 0/4

An error occurred when creating the CloudFormation stack
🛑 Stack [amplify-9071-next-153423] already exists

Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the prDeploying resources into next environment. This will take a few minutes. ⠹
Deploying root stack 9071 [ ---------------------------------------- ] 0/4
^C⏎                                                                                                         ^Aborted!


➜  amplify pull --appId dbaciat8nbvr7 --envName next --yes
Amplify AppID found: dbaciat8nbvr7. Amplify App name is: 9071
Backend environment next found in Amplify Console app: 9071
✔ Successfully pulled backend environment next from the cloud.
Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
  Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
✅ 

After upgrading to v10.2.2 I was not able to initialize my project with the same headless init command.

➜  amplify version
10.2.2

➜  amplify init --envName next --yes
Note: It is recommended to run this command from the root of your app directory
Using default provider  awscloudformation

Deploying resources into next environment. This will take a few minutes. ⠙
Deploying root stack 9071 [ ---------------------------------------- ] 0/4

An error occurred when creating the CloudFormation stack
🛑 Stack [amplify-9071-next-153423] already exists

Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the prDeploying resources into next environment. This will take a few minutes. ⠧
Deploying root stack 9071 [ ---------------------------------------- ] 0/4
^C⏎                                                                                                         ^Aborted!

Marking this as a bug, as a workaround please replace init with pull in your headless scripts, or downgrade to Amplify CLI version 10.0.0.

Hello guys. We had the same problem here at the company I work for and we managed to solve it by downgrading to version 10.0.0. Thanks for sharing the information.

Hey folks I will note I was not able to reproduce this in Amplify Hosting, but this is a bug with headless init nonetheless

image

Thanks for the “amplify pull” workaround, can we still supply the auth params etc using the pull command?

@conorw I don’t believe headless pull will accept those inputs, however I did notice I’m able to run headless init after pulling the project. Could you perhaps run a lean headless pull command (e.g. amplify pull --appId <your-app-id> --envName <env-name> --yes), then run your headless init script?