microsoft / Oryx

Build your repo automatically.
Other
761 stars 174 forks source link

Unable to deploy .NET 6 App to Azure App Service #1242

Closed ABrizmohun closed 9 months ago

ABrizmohun commented 2 years ago

Bug Report

Deployment is done using Azure CLI

az webapp deploy --id $AZURE_APPSERVICE_ID --src-path $PUBLISH_ZIP --clean false --restart true --type zip

App Service Details

Oryx Log

Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform dotnet --platform-version 6.0 -i /tmp/8d9f278aa229dd3 --log-file /tmp/build-debug.log 
Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20211207.1, Commit: 46633df49cc8fbe9718772a3c894df221273b2af, ReleaseTagName: 20211207.1

Build Operation ID: |qxi49x4vRb0=.6ce7b172_
Repository Commit : f4ac3195-47aa-48ae-bacf-d1c27fe22258

Error: Couldn't detect a version for the platform 'dotnet' in the repo.
Detecting platforms...
Could not detect any platform in the source directory.
Error: Couldn't detect a version for the platform 'dotnet' in the repo.\n/opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform dotnet --platform-version 6.0 -i /tmp/8d9f278aa229dd3 --log-file /tmp/build-debug.log
Roshan-Srivastava commented 2 years ago

I am also facing same issue while deploying .net 6 azure function on Linux os

nudejustin commented 2 years ago

We're also seeing this issue across our dotnet and node application deployments

nudejustin commented 2 years ago

@ABrizmohun a workaround we found for now is to set these application settings on your azure app:

"ENABLE_ORYX_BUILD" : "false", "SCM_DO_BUILD_DURING_DEPLOYMENT" : "false",

This disables oryx and reverts to the previous build tool. Hopefully this helps while we wait for official advice from the Oryx team.

ABrizmohun commented 2 years ago

I've switched to running the App Service from a Zip package for now

az webapp deployment source config-zip --id $AZURE_APPSERVICE_ID --src $PUBLISH_ZIP
ilya-git commented 2 years ago

I am not sure if this is related, but I had the same error log in the Azure Function deploy in DevOps Pipelines. It appeared that setting the correct application type has fixed it:

appType: functionAppLinux

After that the deploy was setting WEBSITE_RUN_FROM_PACKAGE not to 1 (which is not supported on linux on consumption plan), but to a url

derekwilliamsliquidx commented 2 years ago

This randomly is affecting our function apps; both new function apps and some older ones that have recently upgraded to dotnet6 runtime. Why is this randomly appearing?

The workaround proposed by @nudejustin worked for our deployments. Oddly enough this is happening with Azure DevOps deployments. This application appears to be intended for use by source code deployments.

nudejustin commented 2 years ago

Is there any update on this issue that can be provided from the Oryx team? Although the workaround I proposed above works for our AppService instances, it does not work whatsoever for any of our Azure Functions instances. This means we have to manually deploy for all of our function apps, which is really really not ideal from an operational standpoint.

I have been through the issue with Microsoft Support and they have advised that this is a known issue and that the team is working on it. It would be good to understand some kinda time frame on when we could expect a fix however?

sanjaysagore commented 1 year ago

Hey Guys , Really stuck since past three days and no resolution yet , I tried all solution but one and another issue I am getting after trying all this. Will appreciate the help for resolution of the issue. Thank you

daniv-msft commented 1 year ago

@nudejustin @sanjaysagore Sorry for the very late reply. Would one of you be willing to share with us a .NET project where we can reproduce the issue? Given the logs shared above, we should mostly interested in the .csproj file so it might not be needed to give us the whole code. I'm happy to give a separate email address if your projects are not public.

sanjaysagore commented 1 year ago

Thank you @daniv-msft Yet my application is of Python Web App using Flask framework, I have reported the issue through the bug https://github.com/microsoft/Oryx/issues/1915. Would you please help in resolution through the mention bug. Thank you sanjaysagore@gmail.com

junior-juarez-MSFT commented 1 year ago

@ABrizmohun a workaround we found for now is to set these application settings on your azure app:

"ENABLE_ORYX_BUILD" : "false", "SCM_DO_BUILD_DURING_DEPLOYMENT" : "false",

This disables oryx and reverts to the previous build tool. Hopefully this helps while we wait for official advice from the Oryx team.

If you are deploying .Net Core web apps from VSCode or Visual Studio, ensure SCM_DO_BUILD_DURING_DEPLOYMENT is set to false or removed from the app settings.

Because VSCode and Visual Studio use OneDeploy instead of Oryx build, using both methods at the same time trigger this issue.

These recommendations are accurate to fix the problem in VSCode or Visual Studio.

SCM_DO_BUILD_DURING_DEPLOYMENT works in scenarios where the code is deployed from Azure CLI, Local Git and GitHub repos using ZIPDEPLOY method - https://learn.microsoft.com/en-us/azure/app-service/reference-app-settings?tabs=kudu%2Cdotnet#build-automation

image

gliviu commented 1 year ago

For deploying functions I got the same error when using

az functionapp deploy --resource-group $RESOURCE_GROUP_NAME --name $APPSERVICE_NAME --src-path package.zip --type zip

After some investigations into the official documentation the error is gone using next command:

az functionapp deployment source config-zip -g $RESOURCE_GROUP_NAME -n $APPSERVICE_NAME --src package.zip
simonjj commented 9 months ago

This issue seems resolved. Will be closing this issue. If this is still relevant and impacting you please open a new issue and link back to this issue for reference.

shared-adame-litmos commented 8 months ago

I am not sure if this is related, but I had the same error log in the Azure Function deploy in DevOps Pipelines. It appeared that setting the correct application type has fixed it:

appType: functionAppLinux

After that the deploy was setting WEBSITE_RUN_FROM_PACKAGE not to 1 (which is not supported on linux on consumption plan), but to a url

Thank you @ilya-git this helped me with my issue.