microsoft / azure-pipelines-tasks

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

`Multiple resource group found for App Service 'kwe'` is showing sporadically #17671

Closed izikl closed 7 months ago

izikl commented 1 year ago

I am getting this sporadic error when deploying with AzureRmWebAppDeploymentV4:

 ##[error]Error: Multiple resource group found for App Service 'kwe'.

I only have one kwe App Service resource under the resource group: image

I am not sure how this line could return different responses: var filteredResources: Array = await azureResources.getResources('Microsoft.Web/Sites', resourceName);

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: AzureRmWebAppDeploymentV4

list here (V# not needed):
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks

Environment

Issue Description

Getting this error sporadically:

2023-01-25T22:56:26.9422580Z ##[error]Error: Multiple resource group found for App Service 'kwe'.
2023-01-25T22:56:26.9513938Z (node:6464) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getApplicationURL' of undefined
2023-01-25T22:56:26.9515186Z     at WindowsWebAppWebDeployProvider.<anonymous> (D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\4.214.0\deploymentProvider\AzureRmWebAppDeploymentProvider.js:60:73)
2023-01-25T22:56:26.9515945Z     at Generator.next (<anonymous>)
2023-01-25T22:56:26.9516620Z     at D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\4.214.0\deploymentProvider\AzureRmWebAppDeploymentProvider.js:8:71
2023-01-25T22:56:26.9517243Z     at new Promise (<anonymous>)
2023-01-25T22:56:26.9518420Z     at __awaiter (D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\4.214.0\deploymentProvider\AzureRmWebAppDeploymentProvider.js:4:12)
2023-01-25T22:56:26.9520381Z     at WindowsWebAppWebDeployProvider.UpdateDeploymentStatus (D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\4.214.0\deploymentProvider\AzureRmWebAppDeploymentProvider.js:54:16)
2023-01-25T22:56:26.9521812Z     at D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\4.214.0\azurermwebappdeployment.js:38:42
2023-01-25T22:56:26.9522485Z     at Generator.throw (<anonymous>)
2023-01-25T22:56:26.9523111Z     at rejected (D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\4.214.0\azurermwebappdeployment.js:6:65)
2023-01-25T22:56:26.9523771Z     at process._tickCallback (internal/process/next_tick.js:68:7)
2023-01-25T22:56:26.9524628Z (node:6464) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
2023-01-25T22:56:26.9525732Z (node:6464) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Task logs

[Enable debug logging and please provide the zip file containing all the logs for a speedy resolution]

tasklog_11.zip

Troubleshooting

Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting

Error logs

[Insert error from the logs here for a quick overview]

ryperl commented 1 year ago

Our team is facing the same issue, if we retry the release (N) times it will finally succeed.

First Failure

2023-01-25T18:01:35.5665032Z ##[section]Starting: Deploy Azure App Service
2023-01-25T18:01:35.5833843Z ==============================================================================
2023-01-25T18:01:35.5834190Z Task         : Azure App Service deploy
2023-01-25T18:01:35.5834375Z Description  : Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby
2023-01-25T18:01:35.5834741Z Version      : 4.214.0
2023-01-25T18:01:35.5834923Z Author       : Microsoft Corporation
2023-01-25T18:01:35.5835106Z Help         : https://aka.ms/azureappservicetroubleshooting
2023-01-25T18:01:35.5835318Z ==============================================================================
2023-01-25T18:01:36.3830196Z Got service connection details for Azure App Service:'MavenTridentDevApi'
2023-01-25T18:01:56.6764443Z ##[error]Error: Multiple resource group found for App Service 'MavenTridentDevApi'.
2023-01-25T18:01:56.6776779Z (node:5596) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getApplicationURL' of undefined
2023-01-25T18:01:56.6780558Z     at WindowsWebAppRunFromZipProvider.<anonymous> (D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\4.214.0\deploymentProvider\WindowsWebAppRunFromZipProvider.js:68:77)
2023-01-25T18:01:56.6781687Z Failed to add release annotation. TypeError: Cannot read property 'getApplicationSettings' of undefined
2023-01-25T18:01:56.6782332Z     at Generator.next (<anonymous>)
2023-01-25T18:01:56.6783295Z     at fulfilled (D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\4.214.0\deploymentProvider\WindowsWebAppRunFromZipProvider.js:5:58)
2023-01-25T18:01:56.6787105Z     at process._tickCallback (internal/process/next_tick.js:68:7)
2023-01-25T18:01:56.6788667Z (node:5596) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
2023-01-25T18:01:56.6790387Z (node:5596) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2023-01-25T18:01:56.6852675Z ##[section]Finishing: Deploy Azure App Service

Second attempt

2023-01-25T18:48:16.4513633Z ##[section]Starting: Deploy Azure App Service
2023-01-25T18:48:16.4668915Z ==============================================================================
2023-01-25T18:48:16.4669352Z Task         : Azure App Service deploy
2023-01-25T18:48:16.4669630Z Description  : Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby
2023-01-25T18:48:16.4670068Z Version      : 4.214.0
2023-01-25T18:48:16.4670296Z Author       : Microsoft Corporation
2023-01-25T18:48:16.4670555Z Help         : https://aka.ms/azureappservicetroubleshooting
2023-01-25T18:48:16.4670882Z ==============================================================================
2023-01-25T18:48:17.2120335Z Got service connection details for Azure App Service:'MavenTridentDevApi'
2023-01-25T18:48:18.6853580Z Trying to update App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"1"}
2023-01-25T18:48:19.2251360Z App Service Application settings are already present.
2023-01-25T18:48:20.1325530Z Package deployment using ZIP Deploy initiated.
2023-01-25T18:48:23.2404348Z Successfully deployed web package to App Service.
2023-01-25T18:48:23.2407714Z NOTE: Run From Package makes wwwroot read-only, so you will receive an error when writing files to this directory.
2023-01-25T18:48:23.2408922Z Trying to update App Service Application settings. Data: {"ASPNETCORE_ENVIRONMENT":"tridentdev","REACT_APP_BACKEND_HOST":"https://MavenTridentDevApi.azurewebsites.net","FEATURE_FLAG_LABEL":"Dev"}
2023-01-25T18:48:23.2410476Z App Service Application settings are already present.
2023-01-25T18:48:24.6426410Z Successfully added release annotation to the Application Insight : MavenTridentDevApi202212122014
2023-01-25T18:48:25.2820161Z App Service Application URL: https://maventridentdevapi.azurewebsites.net
2023-01-25T18:48:25.2939349Z ##[section]Finishing: Deploy Azure App Service
aliquid commented 1 year ago

We are experiencing the same with AzureAppServiceManage@0.

Noticed that we had resource group RG with services APP and APP2 and resource group RG2 without services. Shot in the dark moving APP2 to RG2, see if the intermittent errors go away.

annapriyajose commented 1 year ago

Facing the same issue on AzureRmWebAppDeployment@4 task in our pipelines.

rahukrishcom commented 1 year ago

We are getting this issue again in our pipelines AzureRmWebAppDeployment@4 please let us know whether do we have any solution for the same issue.

chrisnawrot commented 1 year ago

+1 to experiencing the same issue. Our app has unique names for all app services, and this task is reporting multiple resource groups found.

I'm wondering if the bug might be in the following block of code in azure-arm-resources.ts:

result = result.concat(response.body.value);
            if (response.body.nextLink) {
                var nextResult = await this._client.accumulateResultFromPagedResult(response.body.nextLink);
                if (nextResult.error) {
                    throw Error(nextResult.error);
                }
                result = result.concat(nextResult.result);
            }

            return result;

Is it possible for response.body.nextLink to reference the same URL that was originally passed? That would explain a duplicate.

rbv012 commented 1 year ago

facing the same for two azure tasks, AzureAppServiceManage@0 and AzureRmWebAppDeployment@4

vyjadhav1 commented 1 year ago

facing same issue from Github actions as well image

github-actions[bot] commented 8 months ago

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days