Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AzureFunctionApp@1: Deployment may fail to Azure Functions on Linux #16005

Closed
rikat-ms opened this issue Mar 9, 2022 · 9 comments
Closed

AzureFunctionApp@1: Deployment may fail to Azure Functions on Linux #16005

rikat-ms opened this issue Mar 9, 2022 · 9 comments

Comments

@rikat-ms
Copy link

rikat-ms commented Mar 9, 2022

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:

list here (V# not needed): AzureFunctionApp@1
https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/AzureFunctionAppV1/deploymentProvider/BuiltInLinuxWebAppDeploymentProvider.ts

Environment

  • Server - Azure Pipelines or TFS on-premises? Azure Pipelines
  • Agent - Hosted or Private: Any

Issue Description

Deployments to Azure Functions on Linux may fail with the following error.

An unknown error has occurred. Check the diagnostic log for details.

Task logs

Snippet from log.

Processed 18805 files...
An unknown error has occurred. Check the diagnostic log for details.
##[error]Failed to deploy web package to App Service.
##[debug]Processed: ##vso[task.issue type=error;]Failed to deploy web package to App Service.
##[error]To debug further please check Kudu stack trace URL : https://${appservicename}:...@{appservicename}.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace
##[debug]Processed: ##vso[task.issue type=error;]To debug further please check Kudu stack trace URL : https://${appservicename}:...@{appservicename}.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace
##[debug]Deployment Failed with Error: Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
##[debug]task result: Failed
##[error]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
##[debug]Processed: ##vso[task.issue type=error;]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.

Troubleshooting

If we don't specify 'deploymentMethod' and the destination is Azure Function on Linux, Run From Package is selected as the deployment method. Then, the app setting WEBSITE_RUN_FROM_PACKAGE is set to true like this. (this is snippet from log.)

Trying to update App Service Application settings. Data: {"WEBSITES_ENABLE_APP_SERVICE_STORAGE":"true","WEBSITE_RUN_FROM_PACKAGE":"true"}
##[debug][POST]https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{appservicename}/config/appsettings/list?api-version=2016-08-01
##[debug]Correlation ID from ARM api call response : {id}
##[debug]WEBSITES_ENABLE_APP_SERVICE_STORAGE is already present.
##[debug]Value of WEBSITE_RUN_FROM_PACKAGE has been changed to true

However, the correct value for WEBSITES_RUN_FROM_PACKAGE is 1 as follows.
Run your functions from a package file in Azure

If the value is set to true, the zip file is deployed to the file server for App Service and extracted to /home/site/wwwroot but not mounted. So, /home/site/wwwroot is not set to ReadOnly. This happens because true is not an expected value for WEBSITE_RUN_FROM_PACKAGE and it's ignored. If the value is set to 1, the zip file is mounted and /home/site/wwwroot is set to ReadOnly. (I got the information from App Services support.)

Error logs

We can see Deployment Lock Failure in a log file named yyyy-mm-ddThh-mm-ss_xxxxxx_xxx_GET_api-deployments-latest-pending.xml under LogFiles folder in Functions environment.

<step title="DeploymentService.GetResult" date="2022-03-02T02:19:08.339" > <step title="DeploymentService.GetLatestDeployment" date="2022-03-02T02:19:08.453" > <step title="DeploymentManager.GetResults" date="2022-03-02T02:19:08.556" > <step title="Deployment Lock Failure" date="2022-03-02T02:19:10.716" > <step title="Deployment Lock Failure" date="2022-03-02T02:19:14.383" >

@rikat-ms
Copy link
Author

rikat-ms commented Mar 9, 2022

I filed PR #15983 in advance.

@mparker-sc
Copy link

Bumping this, very recently additional validation has been added to function app configuration so deployments to Linux premium function apps are now broken.
image

Since this fix has been here since March, any chance of getting this in so I can do deployments again?

@simon-technocloud
Copy link

Another request to bump this....as it blocking all of my deployments...just happened to clean/delete terraform environment this morning as well...

@runtimeware
Copy link

Bump - our production environments are unable to deploy now either.

We have a mix of Dedicated and Premium skus - and now both are problematic. Was surprised to find out that Dedicated and Premium skus are handled differently (premium defaults to package deployments) but there is no way to override/force Dedicated to do so as well.

Is there any way to override the App Settings to change the behavior of the task at all?

@Tyler-V
Copy link

Tyler-V commented Oct 20, 2022

I just tried Linux for the first time an encountered this - back to Windows I guess

@FinVamp1
Copy link
Contributor

FinVamp1 commented Dec 7, 2022

Can someone let me know if they ate still running into this as we made changes in the v2 Task to ensure that both dedicated and Premium plans on Linux default to 1?

@runtimeware
Copy link

It’s definitely working now! Thanks for resolving as we had several workarounds that sort of worked. No more deployment issues atm

@FinVamp1
Copy link
Contributor

FinVamp1 commented Dec 7, 2022

Thanks @runtimeware for the updates. I'll monitor this issue for another week and see if anyone else has feedback.

@FinVamp1
Copy link
Contributor

Resolving this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants