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

Amplify get stuck on deploy after test phase #1167

Closed
rubfergor opened this issue Oct 26, 2020 · 17 comments
Closed

Amplify get stuck on deploy after test phase #1167

rubfergor opened this issue Oct 26, 2020 · 17 comments
Labels
archived This issue has been locked. bug Something isn't working pending-prioritization Added to the backlog. Pending prioritization.

Comments

@rubfergor
Copy link

Hi,

I'm running a site using a Create React App monorepo. The first build was successful, but after I added a test section Amplify run the tests and tries to publish the test artifacts instead of the frontend ones in a similar scenario to #1160. If I don't put anything in the artifact section of the test, the build complete but the test phase fails but if I put a dummy file with a report from jest it get stuck on deployment after saying that it has published my test artifacts.

2020-10-26T18:46:27 [INFO]: Starting Deployment
2020-10-26T18:46:27 [INFO]: Updating Edge config
2020-10-26T18:46:27 [INFO]: Start deploying test artifact
2020-10-26T18:46:27 [INFO]: Deploying coverage/clover.xml
2020-10-26T18:46:27 [INFO]: Deploying coverage/coverage-final.json
2020-10-26T18:46:27 [INFO]: Deploying coverage/lcov-report/base.css
2020-10-26T18:46:28 [INFO]: Deploying coverage/lcov-report/block-navigation.js
2020-10-26T18:46:28 [INFO]: Deploying coverage/lcov-report/favicon.png
2020-10-26T18:46:28 [INFO]: Deploying coverage/lcov-report/index.html
2020-10-26T18:46:28 [INFO]: Deploying coverage/lcov-report/prettify.css
2020-10-26T18:46:28 [INFO]: Deploying coverage/lcov-report/prettify.js
2020-10-26T18:46:28 [INFO]: Deploying coverage/lcov-report/sort-arrow-sprite.png
2020-10-26T18:46:28 [INFO]: Deploying coverage/lcov-report/sorter.js
2020-10-26T18:46:28 [INFO]: Deploying coverage/lcov.info
2020-10-26T18:46:28 [INFO]: Deploying coverage/report.html
2020-10-26T18:46:29 [INFO]: Finish deploying test artifact

For reference, my region is us-east-1 and my appId is d1s2p57h03rwzi, in build 5 or previous. My YAML file is this:

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - nvm use $VERSION_NODE_12
        - yarn install
    build:
      commands:
        - yarn frontend:build
  artifacts:
    baseDirectory: /frontend/build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
backend:
  phases:
    preBuild:
      commands:
        - nvm use $VERSION_NODE_12
        - yarn install
    build:
      commands:
        - if [ "${AWS_BRANCH}" = "prod" ]; then yarn services:deploy-all --stage prod; else yarn services:deploy-all; fi
  cache:
    paths:
      - node_modules/**/*
test:
  phases:
    preTest:
      commands:
        - nvm use $VERSION_NODE_12
        - yarn install
    test:
      commands:
        - yarn test
    postTest:
      commands:
        - git config --global user.email $GIT_EMAIL
        - git config --global user.name $GIT_USER
        - git checkout ${AWS_BRANCH}
        - yarn release
        - git remote set-url origin "https://oauth2:${GIT_TOKEN}@${GIT_REPO_URL}" # this is needed to use the token with gitlab
        - git push --follow-tags origin HEAD
  cache:
    paths:
      - node_modules/**/*
  artifacts:
    files:
      - coverage/**/*
    baseDirectory: ./

@gwryssekk
Copy link

gwryssekk commented Oct 27, 2020

Hi @rubfergor -- Sorry that you are experiencing this. We'll take a look.

@lorenzk
Copy link

lorenzk commented Oct 29, 2020

We are having the same issue. Our preview app deployment hangs on Finish deploying test artifact indefinitely. We are using Cypress for our tests.

  • App id: d1zweq2xy6txw5
  • Region eu-central-1
amplify.yml
version: 1

backend:
  phases:
    build:
      commands:
        # Try resetting the cache to fix env issues
        # - envCache --set stackInfo ""
        # Execute Amplify CLI with the helper script'
        - amplifyPush --simple

frontend:
  phases:
    preBuild:
      commands:
        - nvm use 12
        - yarn install --frozen-lockfile
    build:
      commands:
        - yarn build
  artifacts:
    baseDirectory: dist
    files:
      - '**/*'
  cache:
    paths:
      - ~/.cache

test:
  phases:
    preTest:
      commands:
        - nvm use 12
        - yarn install --frozen-lockfile
        - yarn run cypress install
    test:
      commands:
        - yarn test:ci
  artifacts:
    baseDirectory: coverage
    files:
      - '**/*'

  cache:
    paths:
      - ~/.cache

I moved the tests into the build phase as a workaround (hat tip to #115 (comment)).

@litwicki litwicki added bug Something isn't working pending-prioritization Added to the backlog. Pending prioritization. labels Oct 29, 2020
@sugi-s
Copy link

sugi-s commented Nov 2, 2020

@litwicki @gwryssekk we are facing similar issue when running Testcafe e2e tests in test phase.....

Logs from deploy phase:
2020-11-02T08:24:28 [INFO]: Starting Deployment 2020-11-02T08:24:28 [INFO]: Start deploying test artifact 2020-11-02T08:24:28 [INFO]: Deploying test-report.json 2020-11-02T08:24:28 [INFO]: Finish deploying test artifact 2020-11-02T08:24:28 [INFO]: Updating Edge config

Here is the appId:
appId: d1n442ck0l1wax
region: eu-west-1
concerned branch is in preview (PR) (pr-108.d1n442ck0l1wax)

However we are running same set of Testcafe tests in develop as part of build phase and it works.....

@litwicki
Copy link
Contributor

@sugi-s This particular scenario is something we are investigating a root cause for and prioritizing as soon as we can. In the meantime are you able to use the workaround proposed?

@Alk3m1st
Copy link

Just noticed this issue and it's similar to what I was experiencing. In my case I was missing configFilePath in the tests > artifacts section. Once I added that pointing to my test report file it starting working. An example is configFilePath: '**/mochawesome.json' as in the documentation here - https://docs.aws.amazon.com/amplify/latest/userguide/running-tests.html (just before the disabling tests section).
Hope it helps.

@rubfergor
Copy link
Author

Hi @litwicki !

Is there any advance? Can I help you somehow in debugging the issue?

@litwicki
Copy link
Contributor

@rubfergor we have not started working on the permanent fix for this issue yet. Are you able to use the workaround proposed here: #1167 (comment)

@sugi-s
Copy link

sugi-s commented Jan 12, 2021

@litwicki Any updates with this issue??? With the workaround we cannot download the screenshots and it is getting difficult to debug issues when there are test failures in CI pipeline. Appreciate if this can be looked into

@rubfergor
Copy link
Author

@litwicki no, I wasn't able to get it up and running with that

@litwicki
Copy link
Contributor

@rubfergor @sugi-s we're looking at a comprehensive approach to resolving this issue permanently that is taking longer than we had originally thought to properly design. We'll be focusing on that with a majority of the team next week and will share updates as we have them.

@m-p-d
Copy link

m-p-d commented Feb 4, 2021

+1 for resolving this issue with some urgency. @litwicki please let us know expected timeline for a fix, as it was already several weeks since you mentioned your team would focus on this 🙏

@monscamus
Copy link

Managed to resolve the deployment failure by including all possible parameters (even though I'm not using them as in Alchemists post).

For anyone doing a similar test regime:

test: phases: test: commands: - npm run-script test -- --watchAll=false --outputFile=outputTests.json --json artifacts: files: - '**/outputTests.json' baseDirectory: __test__ configFilePath: '**/jest.config.js'

Just noticed this issue and it's similar to what I was experiencing. In my case I was missing configFilePath in the tests > artifacts section. Once I added that pointing to my test report file it starting working. An example is configFilePath: '**/mochawesome.json' as in the documentation here - https://docs.aws.amazon.com/amplify/latest/userguide/running-tests.html (just before the disabling tests section).
Hope it helps.

@hanna-becker
Copy link

hanna-becker commented May 2, 2021

Thanks, @monscamus. We had the same issue for months and had just started moving everything over to gitlab-ci because of that. What frustrates me is not that the Amplify CI requires you to set that parameter even when it's not required (I can live with that), but that there was no useful error message in the pipeline. The Deploy stage would only output these two lines:

2021-04-27T12:14:00 [INFO]: Starting Deployment
2021-04-27T12:14:01 [ERROR]: Failed to deploy

How on earth were we supposed to guess that there is a syntax error in the test stage of the amplify.yml from that? And this is not the first issue we ran into with mysterious stage failures in the Amplify CI. Using the Amplify CI has been a terrible user experience so far, because of not providing any useful error logs when things go wrong. Please, Amplify console team, prioritize fixing this.

@allanrlima
Copy link

Any update on this?

@swaminator
Copy link
Contributor

Resolving this issue as we have not observed issues with this after we fixed deployment failures.

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Copy link

This issue has been automatically locked.

@github-actions github-actions bot added the archived This issue has been locked. label Mar 20, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. bug Something isn't working pending-prioritization Added to the backlog. Pending prioritization.
Projects
None yet
Development

No branches or pull requests