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

Unable to deploy .NET 7 Isolated via App Service Build Service #1865

Open
scale-tone opened this issue Aug 26, 2023 · 8 comments · Fixed by scale-tone/azure-func-dotnet-isolated-test#1
Assignees

Comments

@scale-tone
Copy link

Reported it first here, but that repo doesn't seem to attract much attention, so posting it here as well.

Trying to deploy a .NET 7 Isolated project from git sources using Deployment Center (App Service Build Service).
The build succeeds, the log says that all files were successfully created and copied.
But the function does not appear in the list of functions and cannot be triggered (the URL returns 404).
When downloading the app's contents, the downloaded ZIP-file doesn't contain the binaries, only an empty host.json file.

Build logs:

Command: "C:\home\site\deployments\tools\deploy.cmd"
Handling .NET Console Application deployment with MSBuild16.

  Determining projects to restore...
  Restored C:\home\site\repository\azure-func-dotnet-isolated-test.csproj (in 45.07 sec).
  azure-func-dotnet-isolated-test -> C:\local\Temp\8dba59bf286b40f\app_data\jobs\continuous\deployedJob\azure-func-dotnet-isolated-test.dll
  Determining projects to restore...
  Restored C:\local\Temp\4fokofhq.ywu\WorkerExtensions.csproj (in 19.31 sec).
  WorkerExtensions -> C:\local\Temp\4fokofhq.ywu\buildout\Microsoft.Azure.Functions.Worker.Extensions.dll
        1 file(s) copied.
Creating app_offline.htm
KuduSync.NET from: 'C:\local\Temp\8dba59bf286b40f' to: 'C:\home\site\wwwroot'
Copying file: 'hostingstart.html'
Copying file: 'app_data\jobs\continuous\deployedJob\azure-func-dotnet-isolated-test.deps.json'
Copying file: 'app_data\jobs\continuous\deployedJob\azure-func-dotnet-isolated-test.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\azure-func-dotnet-isolated-test.exe'
Copying file: 'app_data\jobs\continuous\deployedJob\azure-func-dotnet-isolated-test.pdb'
Copying file: 'app_data\jobs\continuous\deployedJob\azure-func-dotnet-isolated-test.runtimeconfig.json'
Copying file: 'app_data\jobs\continuous\deployedJob\Azure.Core.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\extensions.json'
Copying file: 'app_data\jobs\continuous\deployedJob\functions.metadata'
Copying file: 'app_data\jobs\continuous\deployedJob\Google.Protobuf.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Grpc.Core.Api.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Grpc.Net.Client.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Grpc.Net.ClientFactory.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Grpc.Net.Common.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\host.json'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Azure.Functions.Worker.Core.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Azure.Functions.Worker.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Azure.Functions.Worker.Extensions.Abstractions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Azure.Functions.Worker.Extensions.Http.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Azure.Functions.Worker.Grpc.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Bcl.AsyncInterfaces.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.Abstractions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.Binder.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.CommandLine.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.EnvironmentVariables.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.FileExtensions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.Json.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.UserSecrets.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.DependencyInjection.Abstractions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.DependencyInjection.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.FileProviders.Abstractions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.FileProviders.Physical.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.FileSystemGlobbing.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Hosting.Abstractions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Hosting.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Http.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Logging.Abstractions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Logging.Configuration.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Logging.Console.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Logging.Debug.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Logging.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Logging.EventLog.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Logging.EventSource.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Options.ConfigurationExtensions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Options.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Primitives.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\System.Diagnostics.EventLog.dll'
Omitting next output lines...
Finished successfully.

Repro steps:

  • Go to Azure Portal and create a Function App instance - North Europe, .NET 7 Isolated, Windows, Consumption tier.
  • Go to the newly created Function App's page.
  • On the Configuration/General Settings tab set 'Basic Auth Publishing Credentials' to 'On' (otherwise App Service Build Service cannot be configured).
  • Go to Deployment Center tab.
  • Configure deployment from an external git repo (you can use this test one, for example) using the built-in build (App Service Build Service).
  • Wait until the build finishes successfully.
  • Observe that the function doesn't get picked up.

Note that it works fine for .NET 6 InProc (last time I checked).

Is there anything that can be configured to make it work?

@kshyju
Copy link
Member

kshyju commented Aug 30, 2023

@mattchenderson Who can help with deployment center(in portal) related issues?

@mattchenderson
Copy link
Contributor

@kulkarnisonia16 for deployment center and tools

@patelchandni
Copy link

It is recommended to use the "GitHub" option from the deployment center, instead of "External Git". It will help you configure a GitHub action workflow which is more reliable and uses this deployment action: https://github.com/Azure/functions-action

@scale-tone
Copy link
Author

@patelchandni , in many scenarios (like the one I'm currently in, which is allowing people to deploy DfMon with an ARM template) deploying with GitHub actions is not an option, as it requires you to have full control over the repo, which many people don't have or don't want to have.

Are you saying that App Service Build Service is now deprecated (because I haven't seen any announcements like that) ?

@paulyuk paulyuk self-assigned this Jan 18, 2024
@paulyuk
Copy link
Member

paulyuk commented Jan 18, 2024

Im escalating and will take a look and assign. If zip is bad suspect this is somewhere in the deployment center package build.

@paulyuk
Copy link
Member

paulyuk commented Jan 19, 2024

@scale-tone
We understand root cause and have a workaround. Could you please try this?
paulyuk/azure-func-dotnet-isolated-test (github.com)

Here is a PR for it:
Add solution file (enables Deployment Center deploy) by paulyuk · Pull Request #1 · scale-tone/azure-func-dotnet-isolated-test (github.com)

The root issue triggering the Deployment center bug is there's no solution file, and then Deployment Center assumes this is a vanilla web app, and not a function, during the deployment build.

@pontusanderssonXD
Copy link

pontusanderssonXD commented Jan 21, 2024

I have the same problem with a .NET 8 Isolated function being zip deployed through a Bamboo plan via Azure CLI.

Build log without .sln file

Command: "C:\home\site\deployments\tools\deploy.cmd"
Handling .NET Console Application deployment with MSBuild16.

  Determining projects to restore...
  Restored C:\local\Temp\zipdeploy\extracted\compileRevenuePerCustomer\func.csproj (in 58.13 sec).
C:\local\Temp\zipdeploy\extracted\compileRevenuePerCustomer\compileRevenuePerCustomer.cs(106,38): warning CS8604: Possible null reference argument for parameter 'source' in 'IEnumerable<<anonymous type: string customer, string articleNumber, SapDataGroupedArticleNumber jsonObj>> Enumerable.Select<SapData, <anonymous type: string customer, string articleNumber, SapDataGroupedArticleNumber jsonObj>>(IEnumerable<SapData> source, Func<SapData, int, <anonymous type: string customer, string articleNumber, SapDataGroupedArticleNumber jsonObj>> selector)'. [C:\local\Temp\zipdeploy\extracted\compileRevenuePerCustomer\func.csproj]
C:\local\Temp\zipdeploy\extracted\compileRevenuePerCustomer\compileRevenuePerCustomer.cs(132,51): warning CS8619: Nullability of reference types in value of type 'KeyValuePair<string, JToken?>' doesn't match target type 'KeyValuePair<string, JToken>'. [C:\local\Temp\zipdeploy\extracted\compileRevenuePerCustomer\func.csproj]
C:\local\Temp\zipdeploy\extracted\compileRevenuePerCustomer\compileRevenuePerCustomer.cs(138,39): warning CS8602: Dereference of a possibly null reference. [C:\local\Temp\zipdeploy\extracted\compileRevenuePerCustomer\func.csproj]
C:\local\Temp\zipdeploy\extracted\compileRevenuePerCustomer\compileRevenuePerCustomer.cs(165,26): warning CS8604: Possible null reference argument for parameter 'source' in 'IEnumerable<mappingData> Enumerable.Where<mappingData>(IEnumerable<mappingData> source, Func<mappingData, bool> predicate)'. [C:\local\Temp\zipdeploy\extracted\compileRevenuePerCustomer\func.csproj]
  func -> C:\local\Temp\8dc187b3b93af8e\app_data\jobs\continuous\deployedJob\func.dll
  Determining projects to restore...
  Restored C:\local\Temp\43xmtwa1.g5j\WorkerExtensions.csproj (in 27.52 sec).
  WorkerExtensions -> C:\local\Temp\43xmtwa1.g5j\buildout\Microsoft.Azure.Functions.Worker.Extensions.dll
        1 file(s) copied.
Creating app_offline.htm
KuduSync.NET from: 'C:\local\Temp\8dc187b3b93af8e' to: 'C:\home\site\wwwroot'
Copying file: 'hostingstart.html'
Copying file: 'app_data\jobs\continuous\deployedJob\Azure.Core.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\extensions.json'
Copying file: 'app_data\jobs\continuous\deployedJob\func.deps.json'
Copying file: 'app_data\jobs\continuous\deployedJob\func.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\func.exe'
Copying file: 'app_data\jobs\continuous\deployedJob\func.pdb'
Copying file: 'app_data\jobs\continuous\deployedJob\func.runtimeconfig.json'
Copying file: 'app_data\jobs\continuous\deployedJob\functions.metadata'
Copying file: 'app_data\jobs\continuous\deployedJob\Google.Protobuf.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Grpc.Core.Api.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Grpc.Net.Client.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Grpc.Net.ClientFactory.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Grpc.Net.Common.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.AI.DependencyCollector.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.AI.EventCounterCollector.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.AI.PerfCounterCollector.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.AI.ServerTelemetryChannel.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.AI.WindowsServer.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.ApplicationInsights.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.ApplicationInsights.WorkerService.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Azure.Functions.Worker.ApplicationInsights.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Azure.Functions.Worker.Core.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Azure.Functions.Worker.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Azure.Functions.Worker.Extensions.Abstractions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Azure.Functions.Worker.Extensions.Http.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Azure.Functions.Worker.Grpc.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Bcl.AsyncInterfaces.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Caching.Abstractions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Caching.Memory.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.Abstractions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.Binder.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.CommandLine.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.EnvironmentVariables.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.FileExtensions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.Json.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Configuration.UserSecrets.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.DependencyInjection.Abstractions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.DependencyInjection.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.FileProviders.Abstractions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.FileProviders.Physical.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.FileSystemGlobbing.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Hosting.Abstractions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Hosting.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Http.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Logging.Abstractions.dll'
Copying file: 'app_data\jobs\continuous\deployedJob\Microsoft.Extensions.Logging.ApplicationInsights.dll'
Omitting next output lines...
Finished successfully.

After i added the solution file the Deployment Center seems to understand that it is a function and seems to build correctly. See attached log
deploy log with solution file.txt

The function seems to be built directly to the wwwroot folder as expected:
Skärmavbild 2024-01-21 kl  12 03 18

However the deploy seems to somehow break the Function App resource. Here are the overview before deployment:
Skärmavbild 2024-01-21 kl  12 13 39

After deployment there is an error Microsoft.Azure.WebJobs.Script: Did not find functions with language [dotnet-isolated]. and the Runtime version says Error:
Skärmavbild 2024-01-21 kl  12 16 13

Trying to call the functions gives a 503 response saying Function host is not running.

These are the appSettings declared in the ARM template:

"appSettings": [
                        {
                            "name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
                            "value": "[concat('InstrumentationKey=',parameters('application_insights_key'),';IngestionEndpoint=https://',resourceGroup().location,'in.applicationinsights.azure.com/;LiveEndpoint=https://',resourceGroup().location,'.livediagnostics.monitor.azure.com/')]"
                        },
                        {
                            "name": "AzureWebJobsStorage",
                            "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageaccount_hostname'),';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageaccount_hostname')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value)]"
                        },
                        {
                            "name": "FUNCTIONS_EXTENSION_VERSION",
                            "value": "~4"
                        },
                        {
                            "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
                            "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageaccount_hostname'),';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageaccount_hostname')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value)]"
                        },
                        {
                            "name": "WEBSITE_CONTENTSHARE",
                            "value": "[toLower(parameters('azurefunctionapp_hostname'))]"
                        },
                        {
                            "name": "WEBSITE_USE_PLACEHOLDER_DOTNETISOLATED",
                            "value": "1"
                        },
                        {
                            "name": "FUNCTIONS_WORKER_RUNTIME",
                            "value": "dotnet-isolated"
                        },
                        {
                            "name": "SCM_DO_BUILD_DURING_DEPLOYMENT",
                            "value": "true"
                        }
                    ]

Edit
My bad, I had a error in the deployment. All works as it should after adding the .sln file. Thanks!

@scale-tone
Copy link
Author

Thanks for your help, @paulyuk .
I confirm that adding an .sln file helps, but only if the project is in repo's root folder.

When deploying something that isn't in the root (and using Project app setting to point to the correct project folder/.csproj file) it still doesn't work.
The correct project is picked up for the build, the build succeeds, but the app instance remains empty.

And you cannot set Project setting to an .sln file path - the build fails then:

The specified project 'C:\home\site\repository\durablefunctionsmonitor.dotnetisolated\sln.sln' is not valid. It needs to point to either a csproj/vbproj file or to a directory.

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

Successfully merging a pull request may close this issue.

7 participants