Possible out of memory building node front-end app

When building my front-end application am seeing the following in the logs:

Creating an optimized production build...
Command still running. No output available. Waiting for next line...
Command still running. No output available. Waiting for next line...
Command still running. No output available. Waiting for next line...
Command still running. No output available. Waiting for next line...
The build failed because the process exited too early. This probably means the system ran out of memory or someone called kill -9 on the process.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /usr/local/bin/node
Arguments: /opt/yarn-v1.22.19/lib/cli.js build:dev1
Directory: /app/projects/virtual-keypad
info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
process "/bin/sh -c yarn vk build:dev1" did not complete successfully: exit code: 1

> importing cache manifest from 314513791066.dkr.ecr.us-east-2.amazonaws.com/z6407b453:latest:
> [builder 15/15] RUN yarn vk build:dev1:
 error Command failed.
 Exit code: 1

Command: /usr/local/bin/node
Dockerfile.vk:30
| RUN yarn vk relay
| >>> RUN yarn vk build:dev1
|

ERROR: failed to solve: process "/bin/sh -c yarn vk build:dev1" did not complete successfully: exit code: 1
❌ Container image 314513791066.dkr.ecr.us-east-2.amazonaws.com/z6407b453:7675463526632223027-52655704ab50282e8423ec5636f8645d6dc65a3e failed to be build: Cannot build Application "z6407b453" due to an error with docker: ExitStatusError { exit_status: ExitStatus(unix_wait_status(256)) }

đź’Ł Deployment failed

Qovery Engine has terminated the deployment

Hi @rjohnson , can you please share your Qovery web console URL for this app? And can you please give more details about the app itself? It’s a frontend app building static contents (NextJS? Other?)

Can you also show us your Dockerfile content?

Thank you

Hi @rophilogene , My url is Services - Qovery

Dockerfile:

FROM node:16.16.0 AS builder

WORKDIR /app

COPY package.json .
COPY yarn.lock .

RUN mkdir -p projects/virtual-keypad
RUN mkdir -p projects/securecom-graphql
RUN mkdir -p projects/common

COPY ./projects/virtual-keypad/package.json ./projects/virtual-keypad
COPY ./projects/securecom-graphql/package.json ./projects/securecom-graphql
COPY ./projects/common/package.json ./projects/common

RUN yarn

COPY .git .git
COPY . ./

# Define an argument to pass the GraphQL URL during build
ARG REACT_APP_GQL_URL

RUN yarn vk relay
RUN yarn vk build:dev1

# Choose NGINX as our base Docker image
FROM nginx:alpine

# Set working directory to nginx asset directory
WORKDIR /usr/share/nginx/html

# Remove default nginx static assets
RUN rm -rf *

# Copy static assets from builder stage
COPY --from=builder /app/projects/virtual-keypad/build .

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]


Indeed, from what I see there is not enough RAM for the build process

#27 [builder 15/15] RUN yarn vk build:dev1
#27 0.342 yarn run v1.22.19
#27 0.393 $ yarn workspace virtual-keypad build:dev1
#27 1.271 $ cross-env REACT_APP_SECURECOM_ENV=dev1 yarn build
#27 1.880 $ cross-env NODE_ENV=production REACT_APP_VERSION=$npm_package_version REACT_APP_SHA=`git rev-parse --short HEAD` rescripts build
#27 5.268 Creating an optimized production build...
Command still running. No output available. Waiting for next line...
Command still running. No output available. Waiting for next line...
Command still running. No output available. Waiting for next line...
Command still running. No output available. Waiting for next line...
#27 505.1 The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.
#27 505.3 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
#27 505.3 error Command failed with exit code 1.
#27 505.5 error Command failed with exit code 1.
#27 505.5 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
#27 505.6 error Command failed.
#27 505.6 Exit code: 1
#27 505.6 Command: /usr/local/bin/node
#27 505.6 Arguments: /opt/yarn-v1.22.19/lib/cli.js build:dev1
#27 505.6 Directory: /app/projects/virtual-keypad
#27 505.6 Output:
#27 505.6 
#27 505.7 info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
#27 505.8 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
#27 505.8 error Command failed with exit code 1.
#27 ERROR: process "/bin/sh -c yarn vk build:dev1" did not complete successfully: exit code: 1

We allocate 4 CPUs and 8GB of RAM per build process. Most of the time, it’s enough but can be increased if necessary. However, before increasing those resources, can you show me what’s inside your package.json for the build:dev1 command?


{
  "name": "virtual-keypad",
  "version": "2.42.3",
  "description": "The Virtual Keypad Browser Client",
  "private": true,
  "repository": {
    "type": "git",
    "url": "git@github.dmp.com:mobiletechnology/virtualkeypad-browser.git"
  },
  "author": "Digital Monitoring Products",
  "scripts": {
    "extract-intl": "node ./scripts/extract-intl.js",
    "analyze": "source-map-explorer 'build/static/js/*.js'",
    "build": "cross-env NODE_ENV=production REACT_APP_VERSION=$npm_package_version REACT_APP_SHA=`git rev-parse --short HEAD` rescripts build",
    "build:dev1": "cross-env REACT_APP_SECURECOM_ENV=dev1 yarn build",
    "build:oct": "cross-env REACT_APP_SECURECOM_ENV=#{OCTOPUS_ENV_VAR} REACT_APP_DEPLOYMENT_ENV=#{OCTOPUS_ENV_VAR} REACT_APP_ENABLE_SENTRY=true yarn build",
    "build:verification": "cross-env REACT_APP_SECURECOM_ENV=verification REACT_APP_ENABLE_SENTRY=true yarn build",
    "build:beta": "cross-env REACT_APP_SECURECOM_ENV=beta REACT_APP_ENABLE_SENTRY=true yarn build",
    "build:production": "cross-env REACT_APP_SECURECOM_ENV=production REACT_APP_ENABLE_SENTRY=true yarn build",
    "start": "cross-env REACT_APP_VERSION=$npm_package_version REACT_APP_SHA=`git rev-parse --short HEAD` rescripts start",
    "start:local": "REACT_APP_GRAPHQL_ENDPOINT=http://localhost:7475 REACT_APP_GRAPHQL_WS_ENDPOINT=ws://localhost:7475/subscriptions cross-env NODE_ENV=development REACT_APP_SECURECOM_ENV=dev1 yarn start",
    "start:local:prod": "REACT_APP_GRAPHQL_ENDPOINT=http://localhost:7475 REACT_APP_GRAPHQL_WS_ENDPOINT=ws://localhost:7475/subscriptions cross-env NODE_ENV=development REACT_APP_SECURECOM_ENV=production yarn start",
    "start:dev1": "cross-env NODE_ENV=development REACT_APP_SECURECOM_ENV=dev1 REACT_APP_ENABLE_SENTRY=false yarn start",
    "start:verification": "cross-env NODE_ENV=development REACT_APP_SECURECOM_ENV=verification REACT_APP_ENABLE_SENTRY=false yarn start",
    "start:production": "cross-env NODE_ENV=production REACT_APP_SECURECOM_ENV=production REACT_APP_ENABLE_SENTRY=true yarn start",
    "start:production-debug": "cross-env NODE_ENV=development REACT_APP_SECURECOM_ENV=production REACT_APP_ENABLE_SENTRY=false yarn start",
    "start:beta": "cross-env NODE_ENV=development REACT_APP_SECURECOM_ENV=beta REACT_APP_ENABLE_SENTRY=false yarn start",
    "release": "npx ts-node -O '{\"module\": \"commonjs\", \"target\": \"ES2019\"}' --log-error --script-mode ./scripts/release.ts",
    "stage": "npx ts-node -O '{\"module\": \"commonjs\", \"target\": \"ES2019\"}' --log-error --script-mode ./scripts/stage.ts",
    "unstage": "npx ts-node -O '{\"module\": \"commonjs\", \"target\": \"ES2019\"}' --log-error --script-mode ./scripts/unstage.ts",
    "presetup": "npm i chalk shelljs",
    "clean:all": "npm run analyze:clean && npm run test:clean && npm run build:clean",
    "lint": "npm run lint:js",
    "lint:eslint": "eslint_d",
    "lint:js": "npm run lint:eslint -- . ",
    "lint:staged": "lint-staged",
    "pretest:coverage": "npm run test:clean",
    "test:clean": "rimraf ./coverage",
    "test": "cross-env REACT_APP_SECURECOM_ENV=production rescripts test",
    "test:debug": "rescripts --inspect-brk test --runInBand --no-cache",
    "test:coverage": "yarn test --coverage",
    "test:ci": "cross-env CI=true yarn test",
    "cypress": "cypress open",
    "cypress:run": "cypress run",
    "coveralls": "cat ./coverage/lcov.info | coveralls",
    "import-icons": "node ./bin/import-icons.js",
    "flow": "flow",
    "styleguide": "styleguidist server",
    "relay": "relay-compiler",
    "type-check": "tsc --noEmit"
  },
  "ci": {
    "on-branch-deleted": "yarn vk unstage {branch}",
    "on-pr-updated": [
      "yarn vk stage {branch}",
      "NODE_ENV=test yarn jest --bail"
    ],
    "on-pr-opened": [
      "yarn vk stage {branch}",
      "NODE_ENV=test yarn jest --bail"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "lint-staged": {
    "*.js": [
      "yarn lint:eslint"
    ]
  },
  "pre-commit": "lint:staged",
  "jest": {
    "collectCoverageFrom": [
      "src/**/*.{js}",
      "!src/**/*.test.{js}",
      "!src/*/RbGenerated*/*.{js}",
      "!src/src.js",
      "!src/global-styles.js",
      "!src/*/*/Loadable.{js}"
    ],
    "coverageThreshold": {
      "global": {
        "statements": 98,
        "branches": 91,
        "functions": 98,
        "lines": 98
      }
    },
    "transformIgnorePatterns": [
      "node_modules/(?!(date-fns)/)"
    ]
  },
  "dependencies": {
    "@dnd-kit/core": "5.0.1",
    "@dnd-kit/modifiers": "5.0.0",
    "@dnd-kit/sortable": "6.0.0",
    "@react-pdf/renderer": "1.6.16",
    "@sentry/browser": "5.12.5",
    "@types/react-select": "^5.0.1",
    "axios": "0.16.2",
    "babel-polyfill": "6.26.0",
    "crypto-js": "3.1.9-1",
    "data.either": "1.5.2",
    "data.maybe": "1.2.3",
    "data.task": "3.1.2",
    "date-fns": "2.29.2",
    "date-fns-tz": "2.0.0",
    "dotenv": "8.2.0",
    "downloadjs": "1.4.7",
    "fontfaceobserver": "2.0.4",
    "fp-ts": "2.9.5",
    "fuse-immutable": "2.0.0",
    "get-node-dimensions": "1.2.0",
    "history": "4.7.2",
    "hls.js": "1.3.4",
    "immutable": "4.0.0",
    "intl": "1.2.5",
    "invariant": "2.2.4",
    "ip": "1.1.3",
    "js-cookie": "2.1.4",
    "jspdf": "2.3.1",
    "jspdf-autotable": "3.5.14",
    "jwt-decode": "3.1.2",
    "keycode": "2.2.0",
    "localforage": "1.7.3",
    "moment": "2.22.2",
    "moment-timezone": "0.5.26",
    "object-hash": "1.3.1",
    "query-string": "6.13.7",
    "raf": "3.4.0",
    "rails-timezone": "1.1.0",
    "ramda": "0.27.1",
    "re-reselect": "1.0.1",
    "react": "18.1.0",
    "react-beautiful-dnd": "11.0.5",
    "react-day-picker": "8.2.0",
    "react-dom": "18.1.0",
    "react-draggable": "3.0.5",
    "react-error-overlay": "6.0.9",
    "react-ga": "2.6.0",
    "react-helmet": "5.2.1",
    "react-immutable-proptypes": "2.1.0",
    "react-input-autosize": "2.2.1",
    "react-intersection-observer": "9.1.0",
    "react-intl": "5.10.0",
    "react-loadable": "5.4.0",
    "react-measure": "1.4.7",
    "react-modal": "3.11.2",
    "react-moment-proptypes": "1.5.0",
    "react-motion": "0.5.2",
    "react-onclickoutside": "6.7.1",
    "react-player": "2.12.0",
    "react-radio-group": "3.0.3",
    "react-redux": "5.0.7",
    "react-relay": "14.0.0",
    "react-remote-resource": "4.2.0",
    "react-router": "4.3.1",
    "react-router-dom": "4.3.1",
    "react-router-redux": "5.0.0-alpha.9",
    "react-scripts": "3.4.4",
    "react-select": "^5.4.0",
    "react-spring": "9.4.5",
    "react-stripe-elements": "1.2.0",
    "react-textarea-autosize": "5.2.1",
    "react-virtualized": "9.21.2",
    "react-visibility-sensor": "3.11.1",
    "react-window": "1.8.5",
    "recompose": "0.30.0",
    "redux": "3.7.2",
    "redux-immutable": "4.0.0",
    "redux-saga": "0.16.0",
    "relay-runtime": "14.0.0",
    "remotedev-serialize": "0.1.8",
    "reselect": "3.0.1",
    "resize-observer-polyfill": "1.4.2",
    "sanitize.css": "4.1.0",
    "search-filterer": "1.6.1",
    "styled-components": "5.3.9",
    "typescript": "4.6.3",
    "uuid": "3.1.0",
    "warning": "3.0.0",
    "whatwg-fetch": "1.0.0",
    "xlsx": "0.16.9"
  },
  "devDependencies": {
    "@babel/parser": "7.1.5",
    "@formatjs/cli": "2.13.15",
    "@rescripts/cli": "0.0.15",
    "@rescripts/rescript-use-babel-config": "0.0.10",
    "@sentry/cli": "1.51.1",
    "@testing-library/cypress": "8.0.3",
    "@testing-library/jest-dom": "5.16.5",
    "@testing-library/react": "13.3.0",
    "@types/immutable": "3.8.7",
    "@types/jest": "26.0.14",
    "@types/node": "14.10.2",
    "@types/node-fetch": "2.5.7",
    "@types/react": "18.0.3",
    "@types/react-dom": "16.9.9",
    "@types/react-pdf": "5.0.0",
    "@types/react-relay": "13.0.2",
    "@types/react-router-dom": "5.1.5",
    "@types/react-router-redux": "5.0.21",
    "@types/react-virtualized": "9.21.10",
    "@types/relay-runtime": "13.0.3",
    "@types/styled-components": "5.1.26",
    "@types/xlsx": "0.0.36",
    "@typescript-eslint/eslint-plugin": "2.x",
    "@typescript-eslint/parser": "2.x",
    "axe-core": "3.3.2",
    "babel-eslint": "10.x",
    "babel-plugin-relay": "14.0.0",
    "case-sensitive-paths-webpack-plugin": "2.1.2",
    "chalk": "1.1.3",
    "cheerio": "0.22.0",
    "compression": "1.7.4",
    "coveralls": "2.13.1",
    "cross-env": "5.2.0",
    "cucumber": "5.1.0",
    "cypress": "10.4.0",
    "enzyme": "3.10.0",
    "enzyme-adapter-react-16": "1.14.0",
    "eslint": "6.x",
    "eslint-config-react-app": "5.2.1",
    "eslint-plugin-cypress": "2.12.1",
    "eslint-plugin-flowtype": "4.x",
    "eslint-plugin-import": "2.x",
    "eslint-plugin-jsx-a11y": "6.x",
    "eslint-plugin-react": "7.x",
    "eslint-plugin-react-hooks": "2.x",
    "eslint_d": "8.1.0",
    "eventsource-polyfill": "0.9.6",
    "express": "4.17.1",
    "flow-inlinestyle": "1.0.9",
    "graphql": "15.3.0",
    "graphql.macro": "1.4.2",
    "husky": "0.14.3",
    "jest-cli": "23.6.0",
    "jest-fetch-mock": "1.6.6",
    "jest-to-match-shape-of": "1.2.0",
    "lint-staged": "7.0.4",
    "minimist": "1.2.0",
    "node-fetch": "2.6.1",
    "plop": "1.5.0",
    "pre-commit": "1.2.2",
    "prop-types": "15.6.1",
    "psi": "2.0.4",
    "react-error-overlay": "6.0.9",
    "react-router-prop-types": "1.0.4",
    "react-test-renderer": "16.3.1",
    "redux-saga-test-plan": "3.7.0",
    "regenerator-runtime": "0.11.1",
    "relay-compiler": "14.0.0",
    "relay-compiler-language-typescript": "15.0.1",
    "rescripts-use-yarn-workspaces": "1.3.4",
    "rimraf": "2.5.4",
    "shelljs": "0.7.4",
    "source-map-explorer": "2.3.1",
    "use-resize-observer": "9.1.0",
    "user-event": "1.4.4",
    "webpack-pwa-manifest": "3.6.2"
  },
  "relay": {
    "src": "./src",
    "schema": "../securecom-graphql/schema.graphql",
    "exclude": [
      "**/node_modules/**",
      "**/__mocks__/**",
      "**/__generated__/**"
    ],
    "language": "typescript",
    "customScalars": {
      "ASCII16CharString": "string",
      "ASCII32CharString": "string",
      "Date": "string",
      "DateTime": "string",
      "EmailAddress": "string",
      "ID": "string",
      "NumberBetween0and99": "number",
      "PasswordInput": "string",
      "PhoneNumber": "string",
      "ScheduleTime": "string",
      "Time": "string",
      "TwilightOffset": "number",
      "URL": "string",
      "GMTOffset": "number"
    },
    "noFutureProofEnums": true
  },
  "resolutions": {
    "@types/node": "14.10.2",
    "@types/node-fetch": "2.5.7",
    "@types/react": "16.9.56",
    "@types/react-dom": "16.9.9",
    "@types/react-pdf": "5.0.0",
    "@types/react-relay": "13.0.2",
    "@types/react-router-dom": "5.1.5"
  }
}

Hello,

I have authorized your organization to change build resources.
You can go in advanced settings of your service and change the allocated RAM for the builder.
For now the limitation is at max 16Gib of RAM. Let me know if it does not solve your build issue.

Thanks @Erebe! Changing to 16gb resolved the issue.

1 Like