azure-pipelines-tasks: Azure App Service Deploy failed - JavaScript heap out of memory

I’m trying to deploy my NodeJS app using Azure App Service Deploy in the Release feature. I’m currently using VSTS default Hosted VS2017 as an agent.

Here’s log:

2017-07-06T08:48:14.6134738Z ##[section]Starting: Azure App Service Deploy: bapul-learning-admin-test
2017-07-06T08:48:14.6274747Z ==============================================================================
2017-07-06T08:48:14.6274747Z Task         : Azure App Service Deploy
2017-07-06T08:48:14.6274747Z Description  : Update Azure App Service using Web Deploy / Kudu REST APIs
2017-07-06T08:48:14.6274747Z Version      : 3.3.9
2017-07-06T08:48:14.6274747Z Author       : Microsoft Corporation
2017-07-06T08:48:14.6274747Z Help         : [More Information](https://aka.ms/azurermwebdeployreadme)
2017-07-06T08:48:14.6274747Z ==============================================================================
2017-07-06T08:48:17.7499766Z Got connection details for Azure App Service:'bapul-learning-admin-test'
2017-07-06T08:48:51.9896729Z FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
2017-07-06T08:48:52.1706751Z ##[error]Exit code 3 returned from process: file name 'C:\LR\mms\Services\Mms\Provisioner\TaskAgent\agents\2.119.1\externals\node\bin\node.exe', arguments '"d:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\3.3.9\azurermwebappdeployment.js"'.

I don’t think that my app causes this failure, since the build process was succeeded without any error.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 53 (18 by maintainers)

Most upvoted comments

For those who are still blocked on that, I have been able to solve this by replacing my “npm” task by a “Command line” task that run npm and set max_old_space_size as an environment variable.

image

@rollercoasterdigital , @scotthwsnyder The issue is fixed and the fix will be available in next deployment (~4-5 weeks)

@nitinmb , looking into this issue. Will update once there is anytrack found.

@Pumba-Coder , Can you try using the new task: image

@vincentdass @asranja I made fake app that reproduce the problem. https://github.com/gongdo/BigUselessSample

[added] https://github.com/gongdo/BigUselessSample/blob/master/test-big-dist.json Here’s the exported build process. I replaced some service names to fake names, so I think it’s safe to share it.

As you can see, there’s almost nothing. It just installs bunch of packages and downloads huge resource(font package from Google 😉 after npm install(see postinstall command).

And I setup VSTS Build like this:

  1. Get sources from the Git repository.
  2. npm install
  3. Archive files
  4. Azure App Service Deploy (the zip from 3)

I’m not sure what exactly makes the JavaScript heap out of memory, but it seems to be related with total size of the contents in the zip file.

I solved this problem to deploy only minified js from the build. But I think many node developers prefer to deploy git repository as it is.

Screenshot 2021-05-04 at 8 40 49 AM

i am facing same issue. any solution?

yes my issue fixed. don’t use @matrial-ui/icons use alternative lib for icons

This is not an issue with Azure pipeline per say, as you can override this behavior to run your build with more memory and still get it to succeed.

An updated version on how to do this isto use the npm package CrossEnv and to set it up this way in your package.json in order to run:

"scripts": {
    "build:prod:aot": "cross-env NODE_OPTIONS=--max_old_space_size=8000 ng build --prod --optimization --build-optimizer --aot --progress"
}

Then you just run your script from properly configuring your Azure pipeline task to do so and you are good to go.

@vincentdass if I use the “Run From Package” deployment method and provide the task the folder path, the task spends over half an hour enumerating the files and copying them into a temp_work_package folder. This appears the same as the Web Deploy method and is what I am trying to avoid by using Zip Deploy.

Separately, the deployment failed, leaving a fole in wwwroot titled FAILED TO DOWNLOAD ZIP FILE.txt with the content Run From Package Initialization failed. Unsupported Zip format or corrupted zip file.

FWIW, looking into the package used to decompress files, decompress-zip, there is an outstanding issue related to a memory error when unzipping a 50MB file. In that case the resolution was to move to a different unzip package, yauzl.