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: ./
Hi @rubfergor -- Sorry that you are experiencing this. We'll take a look.
We are having the same issue. Our preview app deployment hangs on Finish deploying test artifact indefinitely. We are using Cypress for our tests.
d1zweq2xy6txw5eu-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 https://github.com/aws-amplify/amplify-console/issues/115#issuecomment-711909621).
@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.....
@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?
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.
Hi @litwicki !
Is there any advance? Can I help you somehow in debugging the issue?
@rubfergor we have not started working on the permanent fix for this issue yet. Are you able to use the workaround proposed here: https://github.com/aws-amplify/amplify-console/issues/1167#issuecomment-725862271