Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS Amplify CI/CD fail build backend by amplifyPush #1973

Closed
4 tasks done
Rednoll opened this issue Jun 17, 2021 · 7 comments
Closed
4 tasks done

AWS Amplify CI/CD fail build backend by amplifyPush #1973

Rednoll opened this issue Jun 17, 2021 · 7 comments
Labels
archived This issue has been locked.

Comments

@Rednoll
Copy link

Rednoll commented Jun 17, 2021

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?

AWS Amplify CI/CD

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

No response

Amplify CLI Version

5.0.0

What operating system are you using?

Linux (AWS Amplify CI/CD)

Amplify Categories

Not applicable

Amplify Commands

push

Describe the bug

When project try to build (after commit to branch or manually run build) it fails on build backend step with script:

App Id: d2205ysrekymt7
Region: us-east-2

version: 1
backend:
  phases:
    build:
      commands:
        - amplifyPush -e $AWS_BRANCH --simple
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build -- --mode staging
  artifacts:
    baseDirectory: dist
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

It began happening after 09.06.2021 (it's date of last successful build of all my projects)

Maybe it can be related with aws-amplify/amplify-studio#57

Expected behavior

Standard obtaining aws-exports.js and CI/CD flow: Provision -> Build -> Deploy -> Verify

Reproduction steps

  1. Run build in AWS Amplify console
  2. Await backend build step
  3. Receive error "AlreadyExistsException: Stack *** already exists" from amplifyPush

GraphQL schema(s)

No response

Log output

# Put your logs below this line
2021-06-17T16:12:30.797Z [INFO]: Git SSH Key acquired
2021-06-17T16:12:30.873Z [INFO]: # Cloning repository: [email protected]:softwea/dsps-web.git
2021-06-17T16:12:30.920Z [INFO]: Agent pid 136
2021-06-17T16:12:30.946Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2021-06-17T16:12:31.271Z [INFO]: Cloning into 'dsps-web'...
2021-06-17T16:12:31.759Z [INFO]: Warning: Permanently added the RSA host key for IP address '104.192.141.1' to the list of known hosts.
2021-06-17T16:12:32.434Z [INFO]: # Checking for Git submodules at: /codebuild/output/src225761471/src/dsps-web/.gitmodules
2021-06-17T16:12:32.435Z [WARNING]: !Error: ENOENT: no such file or directory, open '/codebuild/output/src225761471/src/dsps-web/amplify.yml'
2021-06-17T16:12:32.454Z [INFO]: # Retrieving environment cache...
2021-06-17T16:12:32.477Z [INFO]: # Retrieved environment cache
2021-06-17T16:12:32.523Z [INFO]: # Ensuring NPM package '@aws-amplify/cli' is version: 'latest'
2021-06-17T16:12:39.315Z [INFO]: # Patching NPM package '@aws-amplify/cli' from 4.29.4 to 5.0.0...
2021-06-17T16:13:30.804Z [INFO]: # Done patching NPM package '@aws-amplify/cli'
2021-06-17T16:13:39.657Z [INFO]: ## Starting Backend Build
                                 # Starting phase: build
                                 # Executing command: amplifyPush -e master --simple
2021-06-17T16:13:39.663Z [INFO]: # Getting Amplify CLI Cloud-Formation stack info from environment cache
2021-06-17T16:13:39.695Z [INFO]: # Start initializing Amplify environment: dev
2021-06-17T16:13:39.696Z [INFO]: # Initializing new Amplify environment: dev (amplify init)
2021-06-17T16:13:43.055Z [INFO]: �[33mNote: It is recommended to run this command from the root of your app directory�[39m
2021-06-17T16:13:43.057Z [INFO]: �[32mThe following configuration will be applied:�[39m
                                 �[0mProject information�[0m
                                 �[0m| Name: dspsweb�[0m
                                 �[0m| Environment: dev�[0m
                                 �[0m| Default editor: Visual Studio Code�[0m
2021-06-17T16:13:43.156Z [INFO]: �[0m| App type: javascript�[0m
2021-06-17T16:13:43.158Z [INFO]: �[0m| Javascript framework: vue�[0m
2021-06-17T16:13:43.158Z [INFO]: �[0m| Source Directory Path: src�[0m
                                 �[0m| Distribution Directory Path: dist�[0m
                                 �[0m| Build Command: npm run-script build�[0m
                                 �[0m| Start Command: npm run-script serve�[0m
2021-06-17T16:13:49.516Z [INFO]: �[0mAmplify AppID found: d2205ysrekymt7. Amplify App name is: dsps2�[0m
2021-06-17T16:13:49.645Z [WARNING]: - Initializing project in the cloud...
2021-06-17T16:13:49.698Z [INFO]: �[31m�[39m
                                 �[31mAn error occurred when creating the CloudFormation stack�[39m
2021-06-17T16:13:49.702Z [WARNING]: ✖ Root stack creation failed
2021-06-17T16:13:49.705Z [INFO]: �[0mAlreadyExistsException: Stack [amplify-dsps2-dev-145805] already exists�[0m
                                 �[0m    at Request.extractError (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/protocol/query.js:50:29)�[0m
                                 �[0m    at Request.callListeners (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:106:20)�[0m
                                 �[0m    at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)�[0m
                                 �[0m    at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:688:14)�[0m
                                 �[0m    at Request.transition (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)�[0m
                                 �[0m    at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)�[0m
                                 �[0m    at /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10�[0m
                                 �[0m    at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)�[0m
                                 �[0m    at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:690:12)�[0m
                                 �[0m    at Request.callListeners (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)�[0m
                                 �[0m    at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)�[0m
                                 �[0m    at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:688:14)�[0m
                                 �[0m    at Request.transition (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)�[0m
                                 �[0m    at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)�[0m
                                 �[0m    at /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10�[0m
                                 �[0m    at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)�[0m
                                 �[0m    at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:690:12)�[0m
                                 �[0m    at Request.callListeners (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)�[0m
                                 �[0m    at callNextListener (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:96:12)�[0m
                                 �[0m    at IncomingMessage.onEnd (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/event_listeners.js:336:13)�[0m
                                 �[0m    at IncomingMessage.emit (events.js:326:22)�[0m
                                 �[0m    at IncomingMessage.EventEmitter.emit (domain.js:483:12)�[0m
                                 �[0m    at endReadableNT (_stream_readable.js:1241:12)�[0m
                                 �[0m    at processTicksAndRejections (internal/process/task_queues.js:84:21) {�[0m
                                 �[0m  code: 'AlreadyExistsException',�[0m
                                 �[0m  time: 2021-06-17T16:13:49.697Z,�[0m
                                 �[0m  requestId: '4a8d0a17-501e-4775-a6c1-ec6dc8fcd477',�[0m
                                 �[0m  statusCode: 400,�[0m
                                 �[0m  retryable: false,�[0m
                                 �[0m  retryDelay: 21.883725136438215�[0m
                                 �[0m}�[0m
2021-06-17T16:13:52.566Z [INFO]: �[33mNote: It is recommended to run this command from the root of your app directory�[39m
2021-06-17T16:13:52.568Z [INFO]: �[32mThe following configuration will be applied:�[39m
2021-06-17T16:13:52.568Z [INFO]: �[0mProject information�[0m
                                 �[0m| Name: dspsweb�[0m
                                 �[0m| Environment: dev�[0m
                                 �[0m| Default editor: Visual Studio Code�[0m
2021-06-17T16:13:52.670Z [INFO]: �[0m| App type: javascript�[0m
2021-06-17T16:13:52.672Z [INFO]: �[0m| Javascript framework: vue�[0m
                                 �[0m| Source Directory Path: src�[0m
                                 �[0m| Distribution Directory Path: dist�[0m
                                 �[0m| Build Command: npm run-script build�[0m
                                 �[0m| Start Command: npm run-script serve�[0m
2021-06-17T16:13:57.612Z [INFO]: �[0mAmplify AppID found: d2205ysrekymt7. Amplify App name is: dsps2�[0m
2021-06-17T16:13:57.737Z [WARNING]: - Initializing project in the cloud...
2021-06-17T16:13:57.788Z [INFO]: �[31m�[39m
                                 �[31mAn error occurred when creating the CloudFormation stack�[39m
2021-06-17T16:13:57.789Z [WARNING]: ✖ Root stack creation failed
2021-06-17T16:13:57.794Z [INFO]: �[0mAlreadyExistsException: Stack [amplify-dsps2-dev-145805] already exists�[0m
                                 �[0m    at Request.extractError (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/protocol/query.js:50:29)�[0m
                                 �[0m    at Request.callListeners (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:106:20)�[0m
                                 �[0m    at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)�[0m
                                 �[0m    at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:688:14)�[0m
                                 �[0m    at Request.transition (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)�[0m
                                 �[0m    at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)�[0m
                                 �[0m    at /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10�[0m
                                 �[0m    at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)�[0m
                                 �[0m    at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:690:12)�[0m
                                 �[0m    at Request.callListeners (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)�[0m
                                 �[0m    at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)�[0m
                                 �[0m    at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:688:14)�[0m
                                 �[0m    at Request.transition (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)�[0m
                                 �[0m    at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)�[0m
                                 �[0m    at /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10�[0m
                                 �[0m    at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)�[0m
                                 �[0m    at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:690:12)�[0m
                                 �[0m    at Request.callListeners (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)�[0m
                                 �[0m    at callNextListener (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:96:12)�[0m
                                 �[0m    at IncomingMessage.onEnd (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/event_listeners.js:336:13)�[0m
                                 �[0m    at IncomingMessage.emit (events.js:326:22)�[0m
                                 �[0m    at IncomingMessage.EventEmitter.emit (domain.js:483:12)�[0m
                                 �[0m    at endReadableNT (_stream_readable.js:1241:12)�[0m
                                 �[0m    at processTicksAndRejections (internal/process/task_queues.js:84:21) {�[0m
                                 �[0m  code: 'AlreadyExistsException',�[0m
                                 �[0m  time: 2021-06-17T16:13:57.786Z,�[0m
                                 �[0m  requestId: 'aef8968f-7ef0-4544-b3cf-0d927ec03b89',�[0m
                                 �[0m  statusCode: 400,�[0m
                                 �[0m  retryable: false,�[0m
                                 �[0m  retryDelay: 60.79723889835387�[0m
                                 �[0m}�[0m
2021-06-17T16:13:57.810Z [ERROR]: !!! Build failed
2021-06-17T16:13:57.810Z [ERROR]: !!! Non-Zero Exit Code detected
2021-06-17T16:13:57.811Z [INFO]: # Starting environment caching...
2021-06-17T16:13:57.811Z [INFO]: # Environment caching completed
Terminating logging...

Additional information

No response

@kaustavghosh06 kaustavghosh06 transferred this issue from aws-amplify/amplify-cli Jun 17, 2021
@github-actions
Copy link

Hi 👋, thanks for opening! While we look into this...

If this issue is related to custom domains, be sure to check the custom domains troubleshooting guide to see if that helps. Also, there is a more general troubleshooting FAQ that may be helpful for other questions.

Lastly, please make sure you've specified the App ID and Region in the issue!

@Athena96
Copy link
Contributor

Hi @Rednoll are you facing this same issue?
#1978

If so please see my comment there on how to resolve.

@Rednoll
Copy link
Author

Rednoll commented Jun 22, 2021

Hi @Athena96 unfortunately your solution did not work for me. I still get "AlreadyExistsException: Stack *** already exists" from amplifyPush

@swaminator
Copy link
Contributor

@Rednoll can you update your buildspec to just use amplifyPush --simple in the backend phase?

@Rednoll
Copy link
Author

Rednoll commented Jun 22, 2021

@swaminator I got another error: "auth headless is missing the following inputParams"

2021-06-22T22:28:20.346Z [INFO]: Git SSH Key acquired
2021-06-22T22:28:20.421Z [INFO]: # Cloning repository: [email protected]:softwea/dsps-web.git
2021-06-22T22:28:20.460Z [INFO]: Agent pid 136
2021-06-22T22:28:20.501Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2021-06-22T22:28:20.774Z [INFO]: Cloning into 'dsps-web'...
2021-06-22T22:28:21.053Z [INFO]: Warning: Permanently added the RSA host key for IP address '104.192.141.1' to the list of known hosts.
2021-06-22T22:28:21.935Z [INFO]: # Checking for Git submodules at: /codebuild/output/src713384932/src/dsps-web/.gitmodules
2021-06-22T22:28:21.936Z [WARNING]: !Error: ENOENT: no such file or directory, open '/codebuild/output/src713384932/src/dsps-web/amplify.yml'
2021-06-22T22:28:21.957Z [INFO]: # Retrieving environment cache...
2021-06-22T22:28:21.990Z [INFO]: # Retrieved environment cache
2021-06-22T22:28:22.041Z [INFO]: # Ensuring NPM package '@aws-amplify/cli' is version: 'latest'
2021-06-22T22:28:27.763Z [INFO]: # Patching NPM package '@aws-amplify/cli' from 4.29.4 to 5.0.1...
2021-06-22T22:29:21.245Z [INFO]: # Done patching NPM package '@aws-amplify/cli'
2021-06-22T22:29:29.215Z [INFO]: ## Starting Backend Build
                                 # Starting phase: build
2021-06-22T22:29:39.320Z [INFO]: �[0mAmplify AppID found: d2205ysrekymt7. Amplify App name is: dsps2�[0m
2021-06-22T22:29:39.440Z [INFO]: �[0mBackend environment dev found in Amplify Console app: dsps2�[0m
2021-06-22T22:29:40.292Z [WARNING]: - Fetching updates to backend environment: dev from the cloud.
2021-06-22T22:29:40.592Z [WARNING]: ✔ Successfully pulled backend environment dev from the cloud.
2021-06-22T22:29:40.606Z [WARNING]: ✖ There was an error initializing your environment.
2021-06-22T22:29:40.608Z [INFO]: �[31mFailed to pull the backend.�[39m
2021-06-22T22:29:40.610Z [INFO]: �[31mauth headless is missing the following inputParams loginwithamazonAppIdUserPool, loginwithamazonAppSecretUserPool�[39m
2021-06-22T22:29:40.614Z [INFO]: �[0mError: auth headless is missing the following inputParams loginwithamazonAppIdUserPool, loginwithamazonAppSecretUserPool�[0m
                                 �[0m    at updateConfigOnEnvInit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/src/provider-utils/awscloudformation/index.js:134:15)�[0m
                                 �[0m    at /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/src/index.js:305:28�[0m
                                 �[0m    at /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/promise-sequential/index.js:16:18�[0m
                                 �[0m    at processTicksAndRejections (internal/process/task_queues.js:97:5)�[0m
2021-06-22T22:29:40.639Z [ERROR]: !!! Build failed
2021-06-22T22:29:40.640Z [ERROR]: !!! Non-Zero Exit Code detected
2021-06-22T22:29:40.640Z [INFO]: # Starting environment caching...
2021-06-22T22:29:40.640Z [INFO]: # Environment caching completed
Terminating logging...

Previously it error can be fixed by - amplifyPush -e $AWS_BRANCH --simple

@cslogan-red
Copy link

@Rednoll after updating your backend statement to simply being amplifyPush --simple, you'll also have to provide the the auth environment variables AMPLIFY_AMAZON_CLIENT_ID and AMPLIFY_AMAZON_CLIENT_SECRET for the branch in question being built (or for all branches), likewise, you can also follow the instructions here to uncheck the full-stack CI/CD box for the branch in question, which will cause the Console to skip running the amplify init that is requiring the two auth environment variables be set for this branch in order to succeed.

@ghost ghost closed this as completed Mar 16, 2022
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the archived This issue has been locked. label Oct 28, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 28, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked.
Projects
None yet
Development

No branches or pull requests

4 participants