Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Container 'Build' exceeded memory limit React

Paula Perret
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 12, 2024

Hello, I'm having a hard time deploying my react app into production environment because it returns:

yarn build
yarn run v1.22.19
$ react-app-rewired build
Creating an optimised production build...
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.

I don't have any further information about what is causing the memory peak other than that log. This is my bitbucket pipeline file:

image: atlassian/default-image:3

pipelines:
  branches:
    stage: #STAGE
        - step:
            name: Build docker
            deployment: Staging
            services:
              - docker
            image: node:16-alpine
            size: 2x
            script:
              - export NODE_OPTIONS=--max-old-space-size=8192
              - yarn install
              - yarn build
              - echo $REACT_APP_AUTH
              - echo $REACT_APP_MEMBERSHIP
              - docker login -u $DOCKER_HUB_ID -p $DOCKER_HUB_PASSWORD
              - docker build -t evoeccdocker/membership_front:stage --build-arg REACT_APP_AUTH=$REACT_APP_AUTH --build-arg REACT_APP_MEMBERSHIP=$REACT_APP_MEMBERSHIP --build-arg REACT_APP_PAYMENT=$REACT_APP_PAYMENT --build-arg REACT_APP_APPLICATION_ID=$REACT_APP_APPLICATION_ID --build-arg REACT_APP_APPLICATION_KEY=$REACT_APP_APPLICATION_KEY --build-arg REACT_APP_TINYMCE=$REACT_APP_TINYMCE --build-arg REACT_APP_GOOGLE_CLIENT_ID=$REACT_APP_GOOGLE_CLIENT_ID --build-arg REACT_APP_GOOGLE_ANALYTICS=$REACT_APP_GOOGLE_ANALYTICS --build-arg REACT_APP_PAYMENT_PAGE_STORAGE_ENCRYPT_SALT=$REACT_APP_PAYMENT_PAGE_STORAGE_ENCRYPT_SALT --build-arg REACT_APP_PAYPAL_CLIENT_ID=$REACT_APP_PAYPAL_CLIENT_ID -f ./Dockerfile-stage .
              - docker push evoeccdocker/membership_front:stage
            caches:
              - docker
              - nodecustom
              - yarn
    master: #MASTER
        - step:
            name: Build docker
            image: node:16-alpine
            size: 2x
            deployment: Production
            services:
              - docker
            script:
              - export NODE_OPTIONS=--max-old-space-size=8192
              - yarn install
              - yarn build
              - docker login -u $DOCKER_HUB_ID -p $DOCKER_HUB_PASSWORD
              - docker build -t evoeccdocker/membership_front:prod --build-arg REACT_APP_AUTH=$REACT_APP_AUTH --build-arg REACT_APP_MEMBERSHIP=$REACT_APP_MEMBERSHIP --build-arg REACT_APP_PAYMENT=$REACT_APP_PAYMENT --build-arg REACT_APP_APPLICATION_ID=$REACT_APP_APPLICATION_ID --build-arg REACT_APP_APPLICATION_KEY=$REACT_APP_APPLICATION_KEY --build-arg REACT_APP_TINYMCE=$REACT_APP_TINYMCE --build-arg REACT_APP_GOOGLE_CLIENT_ID=$REACT_APP_GOOGLE_CLIENT_ID --build-arg REACT_APP_GOOGLE_ANALYTICS=$REACT_APP_GOOGLE_ANALYTICS --build-arg REACT_APP_PAYMENT_PAGE_STORAGE_ENCRYPT_SALT=$REACT_APP_PAYMENT_PAGE_STORAGE_ENCRYPT_SALT --build-arg REACT_APP_PAYPAL_CLIENT_ID=$REACT_APP_PAYPAL_CLIENT_ID -f ./Dockerfile-prod .
              - docker push evoeccdocker/membership_front:prod
            caches:
              - docker
              - nodecustom
              - yarn
definitions:
  caches:
    nodecustom: ./node_modules
    yarn: /usr/local/share/.cache/yarn

 

Does anyone know how to fix it or is there an easy way to discover which library or plugin is causing this peak of memory usage?

1 answer

1 vote
Ste Wright
Community Champion
April 14, 2024

Hi @Paula Perret 

Not sure if this is useful, but I found a similar question to this on the Community.

Does this answer help at all? - https://community.atlassian.com/t5/Bitbucket-questions/Re-Container-Build-exceeded-memory-limit/qaq-p/2289638/comment-id/91040#M91040

Ste

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events