JavaScript heap out of memory error when deploying

Written by Kent
Updated over a week ago
If you see this error in your logs, you can fix this by adding an environment variable.

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

You can set this environment variable in the Environment section:
ENV VAR for javascript heap error - View File

This environment variable specifies the amount of virtual memory allocated to Node.js.

This will help but may only be temporary fix, you may need to find the root cause as well and fix the memory leak issue.


Warning: This example sets the maximum size of the javascript heap to 4 GBs, be careful to not equal or exceed the memory of your server with this ENV VAR, you will have to reduce the size of Megabytes if your server is 4 GBs or smaller.

Was this article helpful?