Running React App with React Snap on AWS Amplify

128 views Asked by At

My build is failing on AWS amplify even after crawling is successful. I am not able to find the root of the cause. I'll share the package.json file and the amplify.yml used along with the screenshot of the build log.

I have added post build script for react-snap. Once amplify finishes the rpm run build successfully, react-snap is initiated. Once it is done successfully, the build fails. I have tried the same locally and it is working.

Please let me know how I can go forward with it

./package.json
{
    "name": "client",
    "version": "0.1.0",
    "private": true,
    "dependencies": {
        "@date-io/date-fns": "^2.13.1",
        "@emotion/react": "^11.7.1",
        "@emotion/styled": "^11.6.0",
        "@mui/lab": "^5.0.0-alpha.69",
        "@mui/material": "^5.4.1",
        "@mui/x-data-grid": "^5.9.0",
        "@mui/x-date-pickers": "^5.0.9",
        "@react-pdf/renderer": "^3.0.0",
        "@testing-library/jest-dom": "^5.16.2",
        "@testing-library/react": "^12.1.2",
        "@testing-library/user-event": "^13.5.0",
        "@wojtekmaj/react-daterange-picker": "^3.4.0",
        "autosuggest-highlight": "^3.3.4",
        "axios": "^0.26.0",
        "buffer": "^6.0.3",
        "chart.js": "^3.9.1",
        "crypto-js": "^4.1.1",
        "date-fns": "^2.28.0",
        "dayjs": "^1.11.6",
        "dotenv": "^16.0.3",
        "framer-motion": "^6.2.6",
        "html-react-parser": "^3.0.4",
        "lottie-react": "^2.2.1",
        "puppeteer": "^20.2.1",
        "react": "^17.0.2",
        "react-calendar": "^4.0.0",
        "react-chartjs-2": "^4.3.1",
        "react-dates": "^21.8.0",
        "react-dom": "^17.0.2",
        "react-google-autocomplete": "^2.7.3",
        "react-helmet": "^6.1.0",
        "react-icons": "^4.3.1",
        "react-infinite-scroll-component": "^6.1.0",
        "react-lazy-load": "^4.0.1",
        "react-otp-input": "^2.4.0",
        "react-pdf": "^6.2.2",
        "react-quill": "^2.0.0",
        "react-redux": "^7.2.6",
        "react-responsive-carousel": "^3.2.23",
        "react-router-dom": "^6.2.1",
        "react-scripts": "5.0.0",
        "react-snap": "^1.23.0",
        "redux": "^4.1.2",
        "redux-persist": "^6.0.0",
        "redux-thunk": "^2.4.1",
        "styled-components": "^5.3.3",
        "web-vitals": "^2.1.4"
    },
    "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject",
        "postbuild": "react-snap"
    },
    "reactSnap": {
        "include": [
            "/",
            "/collections/all",
            "/how-to-rent",
            "/how-to-lend",
            "/about-us",
            "/sustainability",
            "/contact-us",
            "/terms/rental-terms",
            "/terms/lender-agreement",
            "/terms/privacy-policy",
            "/search-product",
            "/blogs"
        ],
        "inlineCss": true,
        "concurrency": 5,
        "timeout": 1000000,
        "puppeteerArgs": [
            "--no-sandbox",
            "--disable-setuid-sandbox"
        ],
        "puppeteerExecutablePath": "/opt/google/chrome/google-chrome"
    },
    "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": {
        "@faker-js/faker": "^7.5.0"
    }
}


./amplify.yml

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - cd client
        - curl https://intoli.com/install-google-chrome.sh | bash
        - npm ci --force
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: client/build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Build log on Amplify

1

There are 1 answers

2
HWine On

Confirm, same issue, same error on aws amplify. Something must've changed in their provisioning in the past couple of days