Increase node heap memory size in azure httptrigger function

Indranil Mondal 21 Reputation points
2022-08-27T17:14:46.963+00:00

I'm creating serverless httptrigger function in azure. And then I execute the function by http get call.

My function executes just fine. But if during runtime there is too many data loaded then I get JavaScript heap out of memory error.

In my local env if I get the issue I can increase the heap size by the command

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

But how I can do the same in the azure environment?
Is there any way to connect the azure environment by command line?
Or in the azure UI do we have any option to set up the heap size for azure env?
235491-screenshot-2022-08-27-at-83453-pm.png

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,679 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vidya Narasimhan 2,126 Reputation points Microsoft Employee
    2022-08-28T05:21:33.963+00:00

    Hi @Indranil Mondal ,

    Please review these memory limits for your functions based on the plan you have chosen https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale#service-limits

    Resource Consumption plan Premium plan Dedicated plan ASE
    Max memory (GB per instance) 1.5 3.5-14 1.75-14 3.5 - 14

    For example, if you are using consumption plan, you will hit a memory issue when approaching consumption near 1.5 GB . Please choose the appropriate and SKU based on your memory requirements


1 additional answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,456 Reputation points
    2022-08-29T12:50:44.813+00:00

    Hi @Indranil Mondal ,

    Thanks for reaching out to Q&A.

    As @Vidya Narasimhan mentioned, the memory limit of an app running on consumption plan is 1.5 gb and it appears that your app is hitting that limit. You can confirm it by running the memory analysis detector present in the diagnose and solve problems blade in functions portal.

    You can try changing the bitness of the app to 64 bit and see if that helps.

    235783-image.png

    Feel free to reach out to me if you have any queries or concerns.

    2 people found this answer helpful.