microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.5k stars 2.61k forks source link

[BUG]: Cannot deploy to function app through DevOps. Can't find loc string for key: KuduStackTraceURL #19077

Open mohibakhan opened 1 year ago

mohibakhan commented 1 year ago

Task name

No response

Task version

No response

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

Azure DevOps Server (Please specify exact version in the textbox below)

Azure DevOps Server Version (if applicable)

No response

Operation system

Azure function app v4

Task log

2023-10-06T15:18:29.3695478Z Got service connection details for Azure App Service:'fa-pmtsvc-rtpreceive-dev-eastus'
2023-10-06T15:18:36.7380639Z NOTE: Function app is VNet integrated.
2023-10-06T15:19:00.2600842Z Updating App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"1"}
2023-10-06T15:19:00.2601240Z Deleting App Service Application settings. Data: ["WEBSITE_RUN_FROM_ZIP"]
2023-10-06T15:19:00.2602137Z App Service Application settings are already present.
2023-10-06T15:19:03.9413211Z Validating deployment package for functions app before Zip Deploy
2023-10-06T15:19:18.1769632Z Package deployment using ZIP Deploy initiated.
2023-10-06T15:49:21.7950285Z ##[error]Failed to deploy web package to App Service.
2023-10-06T15:49:21.7963263Z ##[warning]Can't find loc string for key: KuduStackTraceURL
2023-10-06T15:49:21.7965704Z ##[error]KuduStackTraceURL https://$appname:***@appname/api/vfs/LogFiles/kudu/trace
2023-10-06T15:49:21.7967528Z ##[error]Error: Error: Failed to deploy web package to App Service. Conflict (CODE: 409)
2023-10-06T15:49:22.4655150Z Successfully added release annotation to the Application Insight : appinsightsresourceName
2023-10-06T15:49:23.3354593Z App Service Application URL: https://app name
2023-10-06T15:49:23.3529870Z ##[section]Finishing: Deploy Azure Function App

Relevant log output

2023-10-06T15:18:29.3695478Z Got service connection details for Azure App Service:'fa-pmtsvc-rtpreceive-dev-eastus'
2023-10-06T15:18:36.7380639Z NOTE: Function app is VNet integrated.
2023-10-06T15:19:00.2600842Z Updating App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"1"}
2023-10-06T15:19:00.2601240Z Deleting App Service Application settings. Data: ["WEBSITE_RUN_FROM_ZIP"]
2023-10-06T15:19:00.2602137Z App Service Application settings are already present.
2023-10-06T15:19:03.9413211Z Validating deployment package for functions app before Zip Deploy
2023-10-06T15:19:18.1769632Z Package deployment using ZIP Deploy initiated.
2023-10-06T15:49:21.7950285Z ##[error]Failed to deploy web package to App Service.
2023-10-06T15:49:21.7963263Z ##[warning]Can't find loc string for key: KuduStackTraceURL
2023-10-06T15:49:21.7965704Z ##[error]KuduStackTraceURL https://$appname:***@appname/api/vfs/LogFiles/kudu/trace
2023-10-06T15:49:21.7967528Z ##[error]Error: Error: Failed to deploy web package to App Service. Conflict (CODE: 409)
2023-10-06T15:49:22.4655150Z Successfully added release annotation to the Application Insight : appinsightsresourceName
2023-10-06T15:49:23.3354593Z App Service Application URL: https://app name
2023-10-06T15:49:23.3529870Z ##[section]Finishing: Deploy Azure Function App

Aditional info

No response

mohibakhan commented 1 year ago

The deploy task is stuck at this step, but it is deploying to the function app resource in Azure image

v-mohithgc commented 1 year ago

Hi @mohibakhan are you facing this error intermittently?

davesbrown commented 1 year ago

I received this same error on initial setup of our deploy

v-mohithgc commented 1 year ago

if I'm not wrong, there was a potential fix for this issue which was shipped in version 228. If you're still seeing this error, please enable the debug logs (system.debug=true) and if possible, send us the failed debug logs to analyze further.

Thanks

houlgap commented 1 year ago

I've just started seeing this problem with deployments this afternoon, been doing multiple deployments every day up to now with no issues.

mohibakhan commented 1 year ago

I am not seeing this error now.

pjganesh commented 1 year ago

Still I'm getting this error while deploying the ZIP package to Azure Functions. Tried WEBSITE_WEBDEPLOY_USE_SCM = "true" and restart website as suggested in another post, no luck.

manojruwali commented 1 year ago

Any fixes for the above error.. 2023-10-06T15:18:29.3695478Z Got service connection details for Azure App Service:'fa-pmtsvc-rtpreceive-dev-eastus' 2023-10-06T15:18:36.7380639Z NOTE: Function app is VNet integrated. 2023-10-06T15:19:00.2600842Z Updating App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"1"} 2023-10-06T15:19:00.2601240Z Deleting App Service Application settings. Data: ["WEBSITE_RUN_FROM_ZIP"] 2023-10-06T15:19:00.2602137Z App Service Application settings are already present. 2023-10-06T15:19:03.9413211Z Validating deployment package for functions app before Zip Deploy 2023-10-06T15:19:18.1769632Z Package deployment using ZIP Deploy initiated. 2023-10-06T15:49:21.7950285Z ##[error]Failed to deploy web package to App Service. 2023-10-06T15:49:21.7963263Z ##[warning]Can't find loc string for key: KuduStackTraceURL 2023-10-06T15:49:21.7965704Z ##[error]KuduStackTraceURL https://$appname:***@appname/api/vfs/LogFiles/kudu/trace 2023-10-06T15:49:21.7967528Z ##[error]Error: Error: Failed to deploy web package to App Service. Conflict (CODE: 500)

while runing realease build pipeline I am getting this error ..Any help will be appreciable

patelamit06 commented 11 months ago

did you fix this issue ? I am still facing this issye

milanm commented 11 months ago

We have the same issue for an Azure Function app in a private network. We are deploying via our custom Windows agent.

MrRosendahl commented 10 months ago

We have recently started to get the same error when deploying standard logic apps via pipelines in devops, "Can't find loc string for key: KuduStackTraceURL".

It looks like the actual deployment to Azure succeeds since there is a deployment in Azure with the corresponding date/time.

As a temporary fix we manually press the button "Rerun failed jobs"... sometimes a couple of times, but the error should not happen in the first place.

bernardjeef commented 9 months ago

We have the same issue for an Azure Function in a private network with a private endpoint. We are deploying via our custom Windows agent.

I'm using the task : Task : Azure Functions Deploy Version : 2.231.0

RoryMcCrossan commented 9 months ago

I'm also encountering this error with a public Azure function on Windows, with the same Task/Version as above.

I have full logs from Devops pipeline, although cannot send them publicly. Please advise how I can provide them to you.

Bensoonius commented 9 months ago

Same here. Started happening when we added private endpoints. First we had to create a self hosted Agent, that cleared the initial error. Now this was the next error and we can't get past it.

Here is the log:

2024-01-22T18:53:29.0632979Z ##[section]Starting: Deploy ProcessHL7V2 Azure Function
2024-01-22T18:53:29.0883091Z ==============================================================================
2024-01-22T18:53:29.0883291Z Task         : Azure Functions Deploy
2024-01-22T18:53:29.0883366Z Description  : Update a function app with .NET, Python, JavaScript, PowerShell, Java based web applications
2024-01-22T18:53:29.0883531Z Version      : 2.231.0
2024-01-22T18:53:29.0883600Z Author       : Microsoft Corporation
2024-01-22T18:53:29.0883678Z Help         : https://aka.ms/azurefunctiontroubleshooting
2024-01-22T18:53:29.0883784Z ==============================================================================
2024-01-22T18:53:30.2472882Z Got service connection details for Azure App Service:'<our-function>'
2024-01-22T18:53:33.9735385Z NOTE: Function app has private endpoint(s). Therefore, make sure that you are running this pipeline from a self-hosted agent that has access to the Functions App.
2024-01-22T18:53:34.5113838Z NOTE: Function app is VNet integrated.
2024-01-22T18:53:34.5196370Z Updating App Service Application settings. Data: {"FUNCTIONS_WORKER_RUNTIME":"dotnet-isolated","WEBSITES_ENABLE_APP_SERVICE_STORAGE":"true","WEBSITE_RUN_FROM_PACKAGE":"0"}
2024-01-22T18:53:35.1052328Z App Service Application settings are already present.
2024-01-22T18:54:28.3156609Z Package deployment using ZIP Deploy initiated.
2024-01-22T18:55:20.8327195Z ##[error]Failed to deploy web package to App Service.
2024-01-22T18:55:20.8328633Z ##[warning]Can't find loc string for key: KuduStackTraceURL
2024-01-22T18:55:20.8333678Z ##[error]KuduStackTraceURL https://<our-username>:***@<our-function>.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace
2024-01-22T18:55:20.8337888Z ##[error]Error: Error: Failed to deploy web package to App Service. Error: getaddrinfo ENOTFOUND <our-function>.scm.azurewebsites.net
2024-01-22T18:55:22.5536066Z Successfully added release annotation to the Application Insight : APPI-DEV
2024-01-22T18:55:22.6249863Z ##[warning]Error: Failed to update deployment history. Error: Error: getaddrinfo ENOTFOUND <our-function>.scm.azurewebsites.net
2024-01-22T18:55:23.3100696Z App Service Application URL: https://<our-function>.azurewebsites.net
2024-01-22T18:55:23.3251985Z ##[section]Finishing: Deploy ProcessHL7V2 Azure Function
Bensoonius commented 9 months ago

We were able to resolve after getting in touch with our Azure admins. They had to add a Private Link to the Network interface properties in Azure: which is at: /resource/subscriptions/<subscriptionID>/resourceGroups/<groupName>/providers/Microsoft.Network/networkInterfaces/<yourPrivateEndpointNic>/IpAddresses

Each of our Function Apps has its own private endpoint/NIC, so each one needed a Private Link.

FinVamp1 commented 9 months ago

This still seems to be happening so filed https://github.com/microsoft/azure-pipelines-tasks-common-packages/issues/276

From the last 30 days WarningMessage TaskVersion count_ Can't find loc string for key: KuduStackTraceURL 1.231.0 6662 Can't find loc string for key: KuduStackTraceURL 2.231.0 3300

ajklotz commented 8 months ago

Hi all, I was just facing this issue recently after applying some terraform configuration to our environments. In the Azure App Service deploy task, I changed the Deployment method option to Web Deploy or Run from Package seems to resolve the problem. Previously, this option was left unchecked. When unchecked, auto-detect is used. According to the log file, the failed runs occurred during "Zip Deploy".

However, even if I chose the 'Run from Package' option, this is very similar to the Zip Deploy method and even mentions it is using the Zip Deploy method in the log output, it works.

What's interesting is if I go back and uncheck the 'Select deployment method' option from the task, I no longer get the error. This did this testing using the same build artifacts/same release. Not sure what will happen if I updated files in a branch and built with artifacts that would contain different file contents. But toggling this setting in the release pipeline seems to have did something to make it work better.

Not sure if this is worth mentioning in your other issue @FinVamp1

Edit: worth mentioning that this was a problem with a web app, not a function app as some others have mentioned above.

BrandonVertex commented 8 months ago

Mi nombre es Brandon Sepúlveda y en mi trabajo tuve que actualizar una app web desarrollada en Springboot con java 17 en un servidor web app de azure linux, en el primer deploy de mi app web no ocurrieron errores, en la siguiente actualización a través de un pipeline me ocurrió el mismo error que se comenta más arriba.

Para solucionar esto, cambié el "Deploy method" a "auto" y me dirigí a mi portal azure, donde está mi app web y le di al botón reiniciar, luego ejecuté manualmente el pipeline y esto funcionó.

azure-2 image

my linkdin: www.linkedin.com/in/brandon-sepúlveda-informático

RonaldvanMeer commented 8 months ago

I've been trying to deploy a blazor app, .net 8, through a azure devops yml pipeline, I am getting the error:

image

retrying rerun failed jobs doesn't resolve it.

I have found a solution described here: https://stackoverflow.com/questions/67453259/azure-devops-pipeline-returning-failed-to-deploy-web-package-to-app-service-i/67460495#67460495

giobb commented 8 months ago

I hope someone has similar case to ours because this seems to be an error with multiple possible causes. In our case, it turned out to be a non-existing storage pointed ty the WEBSITE_CONTENTAZUREFILECONNECTIONSTRING setting. I suppose it could also be the case if that is not accessible due to firewall.

FinVamp1 commented 8 months ago

Versions 237 of the Functions Task should resolve this. The App Service Task should also be updated. I will check to see if this helps.

olivoarroba commented 8 months ago

Hi @FinVamp1:

I added a comment just now on this bug https://github.com/microsoft/azure-pipelines-tasks/issues/18766 both bugs look very similar if not identical. Should I expect a resolution of https://github.com/microsoft/azure-pipelines-tasks/issues/18766 also on Versions 237 of Functions task?

If so, what is the expected timeline to get that version rolled out and how do we make sure our DevOps pipeline is pulling it?

Thanks.

FinVamp1 commented 8 months ago

@olivoarroba I don't think this will necessarily resolve https://github.com/microsoft/azure-pipelines-tasks/issues/18766 as I need to investigate where the delay is.

olivoarroba commented 8 months ago

Thanks @FinVamp1. Can you elaborate on what difference do you see between the two bugs? I'd like to understand better so that I can provide better traces to help on these issues.

FinVamp1 commented 7 months ago

Hello,

@olivoarroba I had scoped this issue down to resolving the localized string error and this change rolled out in the 237 version for both v1 and v2 of the task.

This has helped with the occurrences of this warning.

WarningMessage TaskVersion count_
Can't find loc string for key: KuduStackTraceURL 2.231.0 3082
Can't find loc string for key: KuduStackTraceURL 1.231.0 5582
Can't find loc string for key: KuduStackTraceURL 2.231.1 1340
Can't find loc string for key: KuduStackTraceURL 1.231.1 2028
Can't find loc string for key: KuduStackTraceURL 1.237.1 52
Can't find loc string for key: KuduStackTraceURL 2.237.1 36

A number of the reports on this on issue are referencing "Error: Error: Failed to deploy web package to App Service. Conflict" so I am trying to see what the issue is that people are trying to solve here other than the stack trace error and the deployment failure.

For #18766 the v2 task calls zipdeploy/validate and this is where the delay seems to be. If you have an open support case on this then please send me the case number via finbarr at microsoft.com and I'll ask the engineer to escalate to us. I'll try and look at your deployment logs. I'll see what we can do with the timeouts and the app setttings confusion.

olivoarroba commented 7 months ago

HI @FinVamp1: I sent you an email with the support case number and some information about the issue we are observing, thanks for looking into this.

kim3er commented 3 months ago

I encountered this after switching from .NET 6 In Proc to .NET 8 Isolated, and moved to Flex Consumption. The resolution. was to use AzureFunctionApp@2 instead of AzureFunctionApp@1.

lafe commented 2 months ago

We still encounter the issue with the current version of the task:

2024-08-14T13:34:58.5390662Z ##[section]Starting: Azure Function App Deploy: func-AppName-lafe
2024-08-14T13:34:58.5397175Z ==============================================================================
2024-08-14T13:34:58.5397308Z Task         : Azure Functions Deploy
2024-08-14T13:34:58.5397379Z Description  : Update a function app with .NET, Python, JavaScript, PowerShell, Java based web applications
2024-08-14T13:34:58.5397495Z Version      : 2.244.1
2024-08-14T13:34:58.5397553Z Author       : Microsoft Corporation
2024-08-14T13:34:58.5397639Z Help         : https://aka.ms/azurefunctiontroubleshooting
2024-08-14T13:34:58.5397725Z ==============================================================================
2024-08-14T13:34:59.2837067Z Got service connection details for Azure App Service:'func-AppName-lafe'
2024-08-14T13:35:10.5501346Z Updating App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"1"}
2024-08-14T13:35:11.9501732Z Updated App Service Application settings and Kudu Application settings.
2024-08-14T13:36:14.3867733Z Validating deployment package for functions app before Zip Deploy
2024-08-14T13:36:14.8201594Z Package deployment using ZIP Deploy initiated.
2024-08-14T13:36:25.9955138Z Fetching changes.
2024-08-14T13:36:26.1368413Z Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.zip (65.53 MB) to /tmp/zipdeploy/extracted
2024-08-14T13:36:26.1408164Z ##[error]Failed to deploy web package to App Service.
2024-08-14T13:36:26.1417965Z ##[warning]Can't find loc string for key: KuduStackTraceURL
2024-08-14T13:36:26.1419573Z ##[error]KuduStackTraceURL https://$func-AppName-lafe:***@func-appname-lafe.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace
2024-08-14T13:36:26.1422484Z ##[error]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
2024-08-14T13:36:27.0348694Z Successfully added release annotation to the Application Insight : appi-AppName-lafe
2024-08-14T13:36:27.4108705Z App Service Application URL: https://func-appname-lafe.azurewebsites.net
2024-08-14T13:36:27.4208664Z ##[section]Finishing: Azure Function App Deploy: func-AppName-lafe

We are trying to deploy to an Azure Function that has been previously created by a Bicep template.

The pipeline task is defined as follows:

- task: AzureFunctionApp@2
  displayName: 'Azure Function App Deploy: ${{ parameters.FunctionName }}'
  inputs:
    azureSubscription: ${{ parameters.AzureSubscriptionName }}
    appType: functionApp
    appName: ${{ parameters.FunctionName }}
    package: '$(Agent.WorkFolder)/**/${{parameters.ArtifactFileName}}'