Increase the heap memory limit in a self-hosted Slack Integration + enterprise docker container

Increase the heap memory limit in a self-hosted Slack Integration + enterprise docker container

The self-hosted version of Slack Integration + includes installing and launching the docker container in an on-premises environment. In some cases, with significantly large data, users may encounter the following error: FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory.

Resolution

To resolve this in Slack Integration + self-hosted app, you should increase the max-old-space-size value using the NODE_OPTIONS environment variable.

Runbook:

  1. Check the current memory usage that is consumed by the docker container:

docker exec -it <docker_id> /bin/sh
  1. Start the node.js console and print max-old-space-size value:

node console.log(v8.getHeapStatistics());
  1. Next stop container:

docker stop <docker_id> docker rm <docker_id>
  1. Execute the docker container with a higher NODE_OPTIONSenvironment variable:

docker run -d --name <docker_name> -p <port>:<port> -e NODE_OPTIONS="--max-old-space-size=2048" image: docker.nextup.ai/nextup/slack-suite:6.6.1
  1. You can also add the value to the docker-compose:

version: '3.3' services: n8n: image: image: docker.nextup.ai/nextup/slack-suite:6.6.1 ports: - "<port>:<port>" environment: - NODE_OPTIONS=--max-old-space-size=2048
  1. Restart the container using the docker-compose command:

docker-compose down docker-compose up -d