Npm timeout when deploying node app to azure app service using yarn

October 29, 2019

I was trying to deploying a node app to azure app service recently but it kept timing out trying to download all the required modules.

I was able to fix this by specifying an explicit network timeout for the npm install in my azure-pipelines.yaml file

This really helps on the lower app service tiers because they are quite slow.

The network timeout is specified in the last part of this task.

- task: AzureRmWebAppDeployment@4
    inputs:
      ConnectionType: 'AzureRM'
      azureSubscription: '$(azureSubscription)'
      appType: 'webAppLinux'
      WebAppName: '$(serverWebAppName)'
      packageForLinux: '$(System.ArtifactsDirectory)/drop/$(Build.BuildId).zip'
      RuntimeStack: 'NODE|10.16'
      StartupCommand: 'cd server && node dist/index.js'
      ScriptType: 'Inline Script'
      InlineScript: |
        cd server
        yarn install --production --network-timeout=30000

Darragh ORiordan

Hi! I'm Darragh ORiordan. I live and work in Auckland, New Zealand 🥝 enjoying the ocean 🏄 and building things on the web 💻 Contact me on Twitter!