I am trying to configure a Build and Release pipeline for a NodeJS-based Azure App Service (running on Windows), using the documentation provided by Microsoft.
Unfortunately, while there are no errors shown when running the build and release pipelines and deployment shows as being successful, the app fails to load following deployment, with the below error shown in the web.config file in app service editor:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name = "Site Unavailable" stopProcessing = "true">
<match url = ".*" />
<action type = "CustomResponse" statusCode = "503" subStatusCode = "0" statusReason = "Site Unavailable" statusDescription = "Could not download zip" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
A file is also present within app service editor named “FAILED TO INITIALIZE RUN FROM PACKAGE.txt”, within which the error “Run From Package Initialization failed. Unsupported Zip format or corrupted zip file.” is shown.
While the error suggests the zip file used for deployment is invalid in some way, its not clear what exactly is wrong with it, my suspicion is simply that there are too many objects within the zip or it is too big (its over 130MB). I’m not sure how that would be resolved if that is the case however.
I have provided the steps involved in the build and release pipelines below:
Build Pipeline:
Release Pipeline:
Any ideas on how to resolve this would be appreciated.
2
I created a simple Node.js application using the Express Generator referring Deploy a Node.js web app in Azure to test the issue.
I created a same build pipeline to build and publish the zip artifact with the following YAML file.
trigger:
- none
pool:
vmimage: windows-latest
steps:
- task: Npm@1
inputs:
command: 'install'
workingDir: '$(Build.SourcesDirectory)'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
Then I created a release pipeline with the Azure App Service deploy task to deploy the artifact from the build. I choose the Deployment method zip deploy
and set the -SCM_DO_BUILD_DURING_DEPLOYMENT true
in the App setting. This app setting enables build automation at deploy time, which automatically detects the start script and generates the web.config
with it.
Result: