question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Frontend build fails with no error message and continues until timeout.

See original GitHub issue

Describe 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]: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
                                 The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
                                 > https://opencollective.com/core-js 
                                 > https://www.patreon.com/zloirock 
                                 Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
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 EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
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:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

7reactions
swalker326commented, May 11, 2021

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.

2reactions
CiaranCallaghan94commented, Jan 10, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS Amplify Frontend Build Failed on master branch but ...
The only thing I haven't tried yet is reconnecting the master branch in AWS amplify but I don't want to risk the website...
Read more >
Troubleshooting Omnibus GitLab installation issues
Errno::ENOMEM: Cannot allocate memory during backup or upgrade. GitLab requires 2GB of available memory to run without errors. Having 2GB of memory installed ......
Read more >
Angular Error Handling Best Practices - Medium
Learn about centralizing Angular error handling by implementing a global error handler, client and server errors, writing good error messages and more.
Read more >
Troubleshooting AWS CodeBuild
Issue : When you try to create or update a build project, you receive the error Code:InvalidInputException, Message:CodeBuild is not authorized to perform: ......
Read more >
ASP.NET Error Handling - Microsoft Learn
Error logging will allow you to find and fix errors that have occurred. This tutorial builds on the previous tutorial "URL Routing" and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found