Troubleshooting and ErrorsIncrease Node Memory

Troubleshooting: Heap Allocation Failed (Node.js)

If your Node application is running out of memory, you may get this error during the build process, or while the application is running:

Reached heap limit Allocation failed - JavaScript heap out of memory

Solution

In Flightcontrol, add the following environment variable to your service:

NODE_OPTIONS=--max-old-space-size=4096

This option allocates 4GB of memory to the node process.

Note: by default, the standard provisioned project environment (7 GB memory, 4 vCPUs) should be suitable for almost all use cases. If you need to change this configuration, see our documentation on Configuring CodeBuild.