Frontend build fails with no error message and continues until timeout.
See original GitHub issueDescribe the bug I have a relatively simple react application created from (npx create-react-app). I have default build settings and for other apps the build process was seamless for the frontend. However, this app is failing to build and instead of providing any clear error message, the build seems to get stuck and only fails when the build timesout (30 mins). I have ran and build it all locally fine. Want to ensure it is not something Amplify side of things before I lose all my hair 😃
2021-01-08T14:29:27.868Z [INFO]: Git SSH Key acquired
2021-01-08T14:29:27.933Z [INFO]: # Cloning repository: git@github.com:CiaranCallaghan94/mesocialv2.git
2021-01-08T14:29:27.965Z [INFO]: Agent pid 122
2021-01-08T14:29:27.969Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2021-01-08T14:29:28.157Z [INFO]: Cloning into 'mesocialv2'...
2021-01-08T14:29:28.694Z [INFO]: Warning: Permanently added the RSA host key for IP address '140.82.121.4' to the list of known hosts.
2021-01-08T14:29:33.609Z [INFO]: # Checking for Git submodules at: /codebuild/output/src671768753/src/mesocialv2/.gitmodules
2021-01-08T14:29:33.699Z [INFO]: # Retrieving cache...
2021-01-08T14:29:33.729Z [INFO]: # Extracting cache...
2021-01-08T14:29:33.737Z [INFO]: # Extraction completed
2021-01-08T14:29:33.737Z [INFO]: # Retrieving environment cache...
2021-01-08T14:29:33.773Z [INFO]: # Retrieved environment cache
2021-01-08T14:29:33.774Z [INFO]: # Ensuring NPM package '@aws-amplify/cli' is version: '4.29.4'
2021-01-08T14:29:45.303Z [INFO]: ## Starting Frontend Build
# Starting phase: preBuild
# Executing command: npm ci
2021-01-08T14:29:57.860Z [INFO]: > core-js@2.6.12 postinstall /codebuild/output/src671768753/src/mesocialv2/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
2021-01-08T14:29:57.899Z [INFO]: [96mThank you for using core-js ([94m https://github.com/zloirock/core-js [96m) for polyfilling JavaScript standard library![0m
[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: [0m
[96m>[94m https://opencollective.com/core-js [0m
[96m>[94m https://www.patreon.com/zloirock [0m
[96mAlso, the author of core-js ([94m https://github.com/zloirock [96m) is looking for a good job -)[0m
2021-01-08T14:29:57.934Z [INFO]: > ejs@2.7.4 postinstall /codebuild/output/src671768753/src/mesocialv2/node_modules/ejs
> node ./postinstall.js
2021-01-08T14:29:57.967Z [INFO]: Thank you for installing [35mEJS[0m: built with the [32mJake[0m JavaScript build tool ([32mhttps://jakejs.com/[0m)
2021-01-08T14:29:58.120Z [INFO]: > fsevents@1.2.13 install /codebuild/output/src671768753/src/mesocialv2/node_modules/webpack-dev-server/node_modules/fsevents
> node install.js
2021-01-08T14:29:58.153Z [INFO]:
2021-01-08T14:29:58.154Z [INFO]: Skipping 'fsevents' build as platform linux is not supported
2021-01-08T14:29:58.179Z [INFO]: > fsevents@1.2.13 install /codebuild/output/src671768753/src/mesocialv2/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js
2021-01-08T14:29:58.213Z [INFO]:
2021-01-08T14:29:58.213Z [INFO]: Skipping 'fsevents' build as platform linux is not supported
2021-01-08T14:29:58.355Z [INFO]: > core-js@3.8.1 postinstall /codebuild/output/src671768753/src/mesocialv2/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
2021-01-08T14:29:58.848Z [INFO]: > core-js-pure@3.8.1 postinstall /codebuild/output/src671768753/src/mesocialv2/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
2021-01-08T14:29:59.009Z [INFO]: > node-sass@4.14.1 install /codebuild/output/src671768753/src/mesocialv2/node_modules/node-sass
> node scripts/install.js
2021-01-08T14:29:59.768Z [INFO]: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-72_binding.node
2021-01-08T14:30:00.675Z [INFO]: Download complete
2021-01-08T14:30:00.678Z [INFO]: Binary saved to /codebuild/output/src671768753/src/mesocialv2/node_modules/node-sass/vendor/linux-x64-72/binding.node
2021-01-08T14:30:00.713Z [INFO]: Caching binary to /root/.npm/_cacache/node-sass/4.14.1/linux-x64-72_binding.node
2021-01-08T14:30:00.730Z [INFO]: > node-sass@4.14.1 postinstall /codebuild/output/src671768753/src/mesocialv2/node_modules/node-sass
> node scripts/build.js
2021-01-08T14:30:00.855Z [INFO]: Binary found at /codebuild/output/src671768753/src/mesocialv2/node_modules/node-sass/vendor/linux-x64-72/binding.node
2021-01-08T14:30:00.855Z [INFO]: Testing binary
2021-01-08T14:30:00.951Z [INFO]: Binary is fine
2021-01-08T14:30:01.041Z [INFO]: added 2251 packages in 14.831s
2021-01-08T14:30:01.052Z [INFO]: # Completed phase: preBuild
# Starting phase: build
2021-01-08T14:30:01.052Z [INFO]: # Executing command: npm run build
2021-01-08T14:30:01.208Z [INFO]: > mesocialv2@0.1.0 build /codebuild/output/src671768753/src/mesocialv2
> react-scripts build
2021-01-08T14:30:02.217Z [INFO]: Creating an optimized production build...
2021-01-08T14:30:05.986Z [INFO]: Failed to compile.
From the build log you can see it fails to compile after a few seconds but continues until it timeouts. I would have expected a verbose error message after the ‘Failed to compile’. As I mentioned all works when building outside of Amplify.
version: 1
frontend:
phases:
preBuild:
commands: ['npm ci']
build:
commands: ['npm run build']
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- 'node_modules/**/*'
Above is default build spec. Image settings are all default. Below is package.json if beneficial.
{
"name": "XXX",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.5.0",
"aws-amplify": "^3.3.13",
"bootstrap": "^4.5.3",
"node-sass": "^4.14.1",
"react": "^17.0.1",
"react-bootstrap": "^1.4.0",
"react-dom": "^17.0.1",
"react-icons": "^4.1.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
"web-vitals": "^0.2.4",
"react-social-icons": "^4.1.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"prettier": "2.2.1"
}
}
I have seen a similar issue on StackOverflow on this. https://stackoverflow.com/questions/64928623/aws-amplify-fails-to-build-and-compile-without-error-logs
Would love to get your input and see if its something obvious and also any information on why the build continues until eventually timing out. Is there any additional logs available that could assist me here.
Thank you so much.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top GitHub Comments
Problem was that I had changed some file and folder name casing. IE: Paybutton -> PayButton and git was not detecting those updates. Once I changed git setting
git config core.ignorecase false
my changes were updated, when I pushed to my branch AWS deployed correctly.So it appears to be with one of the ways I reference a library in my code. I replicated the build on an EC2 instance (Amazon Linux 2 AMI) and it failed and gave a specific error message which I was able to use to resolve the issue. So the issue was with my project building on a Linux environment but Amplify was freezing and instead of displaying the error message it would get stuck and only show the above after timing out.
Would be great to solve the issue with the build freezing but original issue solved due to issue on my end so closing issue.