azure-pipelines-tasks: Bug: Failed Successful Deployment - Error Handling AzureFunctionAppV1
Required Information
Entering this information will route you directly to the right team and expedite traction.
Question, Bug, or Feature?
Type: Bug
Enter Task Name: AzureFunctionAppV1
Environment
Azure Pipelines
- Account: lostgolfballs
- Project Name: www.lostgolfballs.com
- BuildId: releaseId=1101
Issue Description
Upon running a AzureFunction Task with a zip file, I anticipate that I update an existing function app with the new package files.
Instead, I get a blue screen that looks like:
If I re-run the release, I get my function loading successfully after the task completes.
Task logs
Got service connection details for Azure App Service:'MY_SERVICE'
2019-09-26T19:38:57.8311929Z Updating App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"1"}
2019-09-26T19:38:57.8312354Z Deleting App Service Application settings. Data: ["WEBSITE_RUN_FROM_ZIP"]
2019-09-26T19:39:01.7703054Z Package deployment using ZIP Deploy initiated.
2019-09-26T19:39:22.8310452Z Successfully deployed web package to App Service.
2019-09-26T19:39:28.6247890Z Successfully updated App Service configuration details
2019-09-26T19:39:28.9075674Z App Service Application URL: MY_SERVICE_URL
Other Information:
When it successfully fails, the resulting app content looks like:
Contents of Web.config
:
<?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>
Contents of FAILED TO INITIALIZE RUN FROM PACKAGE.txt
:
Run From Package Initialization failed.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 33 (9 by maintainers)
Turns out, the bug is due to the task running as
Zip Deploy
but still settingWEBSITE_RUN_FROM_PACKAGE=1
.If I manually remove the
WEBSITE_RUN_FROM_PACKAGE
this is fixed.@damienwebdev I experienced the exact same issue today. I’ve been stuck for 4 hours trying to figure out why a newly created Azure Functions app wouldn’t get deployed correctly. After setting the runtime to ~2 (the newly created app has ~3 as default) then zipdeploy started working for me!
@eaarora-ms I can’t confirm that this bug was fixed, so I don’t really know why the issue was closed. I’m still having failing deployments on v1.
I am experiencing the same issue when deploying to Azure App Service from DevOps. I am using all default settings, and providing the .zip file as the artifact from the
dotnet publish
command.Sometimes, my websites will not load. It is intermittent. Refreshing/recycling the website does not work. I have found that the Azure App Service Deploy task is in fact setting
WEBSITE_RUN_FROM_PACKAGE
to1
for all new deployments. Previous deployments that we have from TFS 2017 were not setting this flag.I can also confirm that, on a broken site, removing the
WEBSITE_RUN_FROM_PACKAGE
app setting causes the website to load again.This is what the error looks like in Azure:
Is this a problem with Azure App Service or the App Service Deploy task? How can I ensure my deployments don’t break like this?
Cleaning up the resource group and redeploying worked for me. It was weird but I was shocked when the same release from Azure DevOps deployed correctly to one resource group while it didn’t to the other. The release itself was successful. Simply tried cleaning up the resource group and it worked.
+1 Only after I manually delete the WEBSITE_RUN_FROM_PACKAGE setting, the function becomes visible in the portal. I believe that this setting is being added automatically. I had deployed using ARM templates and I didn’t have this setting in it. If this setting is enabled by default, is there a way to override and disable it using ARM templates?
I am also intermittently seeing this issue. It appears most often on an initial deployment of the Function App, or seems to be, anyway.
I am getting exactly this issue (again). But the issue is still Closed (and so not on MS’s radar). Worth opening new bug and linking to this?
@qJake Clean up means deleting all the resources within the resource group. I thought I’d have to recreate the resource group as I have read in other threads. But fortunately removing the resources worked.
This is an issue with one of the REST APIs (Update App Settings API to be specific) and we are working with the App service team to get this resolved. You can check the update here: https://github.com/microsoft/azure-pipelines-tasks/issues/11661
Sorry that this is taking longer than expected.