Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab CI Pipeline Job gives error JavaScript heap out of memory

We have a WordPress plugin written in JS with the help of the tool wp-reactivate.

Our goal is to make a GitLab CI Pipeline that increases the version in all places, builds the project and deploys it to the WordPress.org SVN repository. So far, the SVN deployment does work, incrementing the version number is unimplemented yet, but we have a problem building the project. The GitLab CI Runner refuses to finish the process since it ran out of available memory.

The error message

We have already tried (with no effect):

  • Setting GENERATE_SOURCEMAP=false
  • Setting NODE_OPTIONS="--max_old_space_size=8192"
  • Running node --max-old-space-size=8192

Our .gitlab-ci.yml file:

stages:
  - build
  - deploy

default:
  image: node

BuildApp:
  stage: build
  before_script:
    - GENERATE_SOURCEMAP=false
    - NODE_OPTIONS=\"--max_old_space_size=8192\"
    - node --max-old-space-size=8192
  script:
    - yarn
    - yarn prod

PluginSVN:
  stage: deploy
  before_script:
    - apt-get install subversion
    - curl -o /usr/bin/deploy.sh https://git-cdn.e15r.co/open-source/wp-org-plugin-deploy/raw/master/scripts/deploy.sh
    - chmod +x /usr/bin/deploy.sh
  script: /usr/bin/deploy.sh
  when: on_success

Is there any way to increase the amount of available memory, or reduce the amount of memory required for building the project?

like image 866
Nagy Olivér Avatar asked Oct 19 '25 03:10

Nagy Olivér


2 Answers

Check Gitlab Forum: Every runner only have 1CPU, 4GB RAM,

which means you don't have to adjust node options, it won't work.

For me, self-hosted is an option.

like image 195
Will Avatar answered Oct 20 '25 17:10

Will


what ever I install gitlab-runner on self host, or docker, I got same issue.

Finally I got the root cause. The ec2 instance I created is too low, t2.micro

After I adjust it to t3.medium (you should be fine to adjust to any, with 4GB+ memory), it works without this issue any more.

like image 37
Bill Avatar answered Oct 20 '25 16:10

Bill