microsoft / chat-copilot

MIT License
1.92k stars 658 forks source link

deploy-webapi.ps1 : Write-Error: Could not get Azure WebApp resource name from deployment output. #475

Closed jegberin closed 8 months ago

jegberin commented 9 months ago

Describe the bug: When running the ./deploy-webapi.ps1 PowerShell script with valid parameters, I receive an error stating that the deployment '{DEPLOYMENT_NAME}' could not be found in the resource group '{RESOURCE_GROUP_NAME}'.

To Reproduce Steps to reproduce the behavior:

Open PowerShell PS C:\Users{USERNAME}\chat-copilot\scripts\deploy> ./package-webapi.ps1 BuildConfiguration: Release DotNetFramework: net6.0 TargetRuntime: win-x64 OutputDirectory: C:\Users{USERNAME}\chat-copilot\scripts\deploy Build configuration: Release MSBuild version 17.7.3+8ec440e68 for .NET Determining projects to restore... All projects are up-to-date for restore. CopilotChatShared -> C:\Users{USERNAME}\chat-copilot\shared\bin\Release\net6.0\CopilotChatShared.dll CopilotChatWebApi -> C:\Users{USERNAME}\chat-copilot\webapi\bin\Release\net6.0\win-x64\CopilotChatWebApi.dll CopilotChatWebApi -> C:\Users{USERNAME}\chat-copilot\scripts\deploy\publish\ Compressing to C:\Users{USERNAME}\chat-copilot\scripts\deploy/out/webapi.zip Published webapi package to 'C:\Users{USERNAME}\chat-copilot\scripts\deploy/out/webapi.zip' PS C:\Users{USERNAME}\chat-copilot\scripts\deploy> ./deploy-webapi.ps1 -Subscription {SUBSCRIPTION_ID} -ResourceGroupName {RESOURCE_GROUP_NAME} -DeploymentName {DEPLOYMENT_NAME} Getting Azure WebApp resource name... ERROR: (DeploymentNotFound) Deployment '{DEPLOYMENT_NAME}' could not be found. Code: DeploymentNotFound Message: Deployment '{DEPLOYMENT_NAME}' could not be found. Write-Error: Could not get Azure WebApp resource name from deployment output. In the anonymized version, I have replaced all personal information with placeholders. Please replace {USERNAME}, {SUBSCRIPTION_ID}, {RESOURCE_GROUP_NAME}, and {DEPLOYMENT_NAME} with the appropriate values when you use this.

See error: (DeploymentNotFound) Deployment '{DEPLOYMENT_NAME} ' could not be found. Expected behavior The script should run successfully and deploy the web API to the specified resource group without any errors.

Screenshots [If applicable, add screenshots of the error message] PowerShell output: image

Platform

OS: [Your OS here, e.g. Windows, Mac] IDE: [Your IDE here, e.g. Visual Studio, VS Code] Language: PowerShell Source: https://github.com/microsoft/chat-copilot/scripts/deploy/ Additional context I have verified that my Azure subscription is active and I have the necessary permissions. I have also tried to list all deployments in the resource group using the Azure CLI, and the deployment '{DEPLOYMENT_NAME} ' does not appear in the list. I have attempted to substitute the {DEPLOYMENT_NAME} with Microsoft.Template-20231006115334, without resolve. I have this error both if the solution is deployed using the Microsoft.Template as well as with deploy-azure.ps1

TaoChenOSU commented 9 months ago

Hi @jegberin,

Thank you for posting the issue!

The deployment name can be anything. It's just a name for you as the user to identify your deployment.

Can you confirm if you have run the deploy-azure script prior to running the deploy-webapi script? If so, did it run successfully?

jegberin commented 9 months ago

Hi @jegberin,

Thank you for posting the issue!

The deployment name can be anything. It's just a name for you as the user to identify your deployment.

Can you confirm if you have run the deploy-azure script prior to running the deploy-webapi script? If so, did it run successfully?

Yes i did run it. it completed with an error. image image image

TaoChenOSU commented 9 months ago

Hello @jegberin,

If you go to you resource group in Azure portal and look for the deployment log, you will see exactly which resource failed to deploy.

  1. Click on Deployments: image

  2. Click on the latest deployment.

douglasware commented 8 months ago

For me it is failing on: function-copichat-***-websearcher-plugin/default

{ "status": "Failed", "error": { "code": "BadRequest", "message": "Encountered an error (ServiceUnavailable) from host runtime.", "details": [ { "message": "Encountered an error (ServiceUnavailable) from host runtime." }, { "code": "BadRequest" }, {} ] } }

douglasware commented 8 months ago

Ran the deployment again and it got further: ARM-MSDeploy Deploy Failed: 'Microsoft.Web.Deployment.DeploymentDetailedException: Object of type 'package' and path 'C:\local\Temp\6c2fab9d-61e6-4ef2-921f-fe4afbb7ab30.zip' cannot be created. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXCEPTION_WHILE_CREATING_OBJECT. ---> Microsoft.Web.Deployment.DeploymentException: The Zip package 'C:\local\Temp\6c2fab9d-61e6-4ef2-921f-fe4afbb7ab30.zip' could not be loaded. ---> System.IO.EndOfStreamException: Unable to read beyond the end of the stream. at System.IO.Error.EndOfFile() at System.IO.BinaryReader.FillBuffer(Int32 numBytes) at System.IO.BinaryReader.ReadInt32() at Microsoft.Web.Deployment.ZipFile.Load() at Microsoft.Web.Deployment.ZipPackageProvider..ctor(DeploymentProviderContext providerContext, DeploymentBaseContext baseContext, String path) --- End of inner exception stack trace --- at Microsoft.Web.Deployment.ZipPackageProvider.GetAttributes(DeploymentAddAttributeContext addContext) at Microsoft.Web.Deployment.DeploymentObject.EnsureValidAttributes() --- End of inner exception stack trace --- at Microsoft.Web.Deployment.DeploymentManager.CreateObjectPrivate(DeploymentProviderContext providerContext, DeploymentBaseOptions baseOptions, DeploymentObject sourceObject, String serverVersion) at Microsoft.Web.Deployment.DeploymentManager.CreateObject(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions) at Microsoft.Web.Deployment.WebApi.AppGalleryPackage.Deploy(String deploymentSite, String siteSlotId, Boolean doNotDelete) in C:\w\1\s\src\hosting\wdeploy\Microsoft.Web.Deployment.WebApi\AppGalleryPackage.cs:line 250 at Microsoft.Web.Deployment.WebApi.DeploymentController.<DownloadAndDeployPackage>d25.MoveNext() in C:\w\1\s\src\hosting\wdeploy\Microsoft.Web.Deployment.WebApi\Controllers\DeploymentController.cs:line 495' (Code: Failed)

ablack34 commented 8 months ago

Hi,

Also got this error when running ./deploy-webapi.ps1.

C:\Users\Public\chat-copilot\chat-copilot\scripts\deploy\deploy-webapi.ps1 : Could not get Azure WebApp resource name
from deployment output.

My deployment had 2 App Insight failures.

app-copichat-w2yeaqzpuezs4-webapi/Microsoft.ApplicationInsights.AzureWebSites

{ "status": "Failed", "error": { "message": "Microsoft.ApplicationInsights.AzureWebSites" } }

And

app-copichat-w2yeaqzpuezs4-memorypipeline/MSDeploy

{ "status": "Failed", "error": { "code": "BadRequest", "message": "" } }

I also can't see a frontend? Is this something to do with the static files being hosted in the webAPI app service and due to this failed ./deploy-webapi.ps1 command the webAPI is not operational and the frontend not deployed?

Any workaround available? My goal is to get the frontend and backend fully deployed into an azure environment.

crickman commented 8 months ago

Hi @jegberin, have you been able to proceed beyond this issue?

jegberin commented 8 months ago

Hi @jegberin, have you been able to proceed beyond this issue?

No, i have asked our MS dedicated account team as well to assist on this, but didn't get any further.

glahaye commented 8 months ago

@jegberin Try with the latest version of the script. A lot of stabilizing fixes have been put in during the last few weeks.

Also, to answer your question, frontend files are now served by the backend by default to reduce the number of moving parts. Just point to your backend and you should see the SPA site. You can deploy the files elsewhere yourself if you want to as well.