Azure Pipelines: "Package deployment using ZIP Deploy failed. Refer logs for more details": which logs, and what they say
The App Service deploy tasks (AzureRmWebAppDeployment@3, @4 and @5, AzureWebApp@1, AzureFunctionApp@1 and @2) send the zip to Kudu, the deployment service on the app's scm site, with isAsync=true, and then ask Kudu every 5 seconds how the deployment is going. This error means the upload itself went through: Kudu unpacked the package, maybe built it, and ended the deployment with the status Failed. The task then prints Kudu's deployment log and stops with this sentence, so the cause is in the lines just above it (the task's source). The most read question on it has been seen over 45,000 times on Stack Overflow, and its asker found nothing helpful in the logs.
What it looks like
- In the questions it reads
Error: Failed to deploy web package to App Service. Error: Deployment Failed, Package deployment using ZIP Deploy failed. Refer logs for more details.or##[error]Deployment Failed with Error: Package deployment using ZIP Deploy failed. Refer logs for more details. - Above it are Kudu's lines, such as
Extracting pushed zip file ... to /tmp/zipdeploy/extracted,Running oryx build..., and a summary such asDeployment Failed. deployer = GITHUB_ZIP_DEPLOY deploymentPath = ZipDeploy. Extract zip. Remote build.The summary only names the steps that ran; the line that says what failed comes before it. - If the error ends in an HTTP code such as
Conflict (CODE: 409)instead, Kudu refused the upload itself: see what the code after "Failed to deploy web package to App Service" means. - GitHub Actions'
azure/webapps-deployprints the same sentence (the deployer is thenGITHUB_ZIP_DEPLOY), and the causes below are the same.
When the deploy runs in a pull request's build validation, the required build stays failed until a deploy goes through: Azure DevOps Pull Requests, a plugin for JetBrains IDEs, lists the pull request's branch policies with their state in your IDE, and with Pro runs a failed build policy again once the pipeline is fixed. Its Pipelines tab (version 1.0.86 and later) lists the runs of the repositories you have open and opens a failed task's log in the editor, free to read.
"There is not enough space on the disk" while unpacking
- Kudu saves the zip and unpacks it into a temporary folder (
C:\local\Temp\zipdeploy\extractedon Windows,/tmp/zipdeploy/extractedon Linux), then copies the files towwwroot. On Windows that folder is the app's local storage, which App Service limits by tier: 500 MB on Free, Shared and Consumption (Azure Functions), 11 GB on B1, S1 and P1 (Microsoft's page on the App Service file system). The zip and its unpacked copy both have to fit. - On one question, unpacking a 191.73 MB zip of more than 40,000 files ended this way. The answers deploy only the
buildfolder thatnpm run buildmakes, not the sources andnode_modules. - Other ways out: a tier with more local storage, or Run From Package (the task's Deployment method, or
WEBSITE_RUN_FROM_PACKAGE=1): the zip is mounted as a read-onlywwwrootinstead of being copied into it (Microsoft's page on running from a package). The app can then no longer write towwwroot.
A build ran on the app and failed: Running oryx build...
- By default Kudu takes a zip as ready to run and builds nothing. With the app setting
SCM_DO_BUILD_DURING_DEPLOYMENTset totrueor1, it runs the same build as a Git deployment, such asnpm installordotnet publish(Microsoft's page on ZIP deploy, Kudu's wiki). On Linux the build is Oryx, and the log showsCommand: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.9 ...followed by the output of pip or npm. - The error of pip or npm in those lines is the cause: a package that does not install on the app's runtime version, or a build script that fails. For Python, Oryx looks for
requirements.txt,pyproject.tomlorsetup.pyin the project root (Microsoft's page on Python apps), so a zip whose top level is a folder has none: zip the contents of the folder. - For Python on Linux, Microsoft's page has App Service install the packages this way, so keep the setting and fix what pip says. For Node.js and .NET you can instead build on the agent, deploy the result, and leave the setting off.
The task shows no log
- The task fetches Kudu's log after the deployment ends. If that fetch fails, it writes only a debug line, and the error comes with nothing above it.
- Set the variable
system.debugtotrueand run again: the task then prints Kudu's log for every deployment, and the debug lines include the log's URL. - Or read the log where Kudu keeps it: Deployment Center, Logs, in the portal, or the scm site's deployments API:
https://<app>.scm.azurewebsites.net/api/deploymentslists the deployments, and/api/deployments/<id>/loggives one deployment's entries (Kudu's REST API). - The most voted answer on the most read question selects Disconnect in the app's Deployment Center and runs the pipeline again. A source control connection set up there earlier also broke deploys in the 500 case.
Azure DevOps pull requests in IntelliJ IDEA and Rider
Azure DevOps Pull Requests, a plugin by Lesstep for JetBrains IDEs 2024.1 or later and Android Studio, reads the organization, project and repository from your git remote and lists the pull requests that wait for your review in an IDE tool window, on Azure DevOps Services and on Azure DevOps Server. It shows the branch policies of a pull request with their state, so a required build that has not passed is next to its pull request, and with Pro you run a failed or expired build policy again from there. The review inbox is free; voting, commenting, completing and creating are Pro, with a 30-day trial.
Get it on JetBrains Marketplace
Azure DevOps, Azure Pipelines and Azure App Service are trademarks of Microsoft Corporation; GitHub and GitHub Actions are trademarks of GitHub, Inc.; IntelliJ IDEA and Rider are trademarks of JetBrains s.r.o. This page is not affiliated with or endorsed by Microsoft, GitHub, Inc. or JetBrains.
More: Can't find loc string for key · an HTTP code after Failed to deploy web package · no zip where the deploy task looks · no space left on the agent · a dotnet command failed · 日本語