Azure / azure-functions-host

The host/runtime that powers Azure Functions
https://functions.azure.com
MIT License
1.94k stars 441 forks source link

0 functions found when deploying build in Kubernetes linux container from linux #7995

Open gurpreed opened 2 years ago

gurpreed commented 2 years ago

Steps:

  1. Create a new "isolated" Azure Functions app in VS 2022 with .net 6.0
  2. Create a build in linux using "dotnet build"
  3. Create a linux container with dockerfile:

Installer image

FROM mcr.microsoft.com/azure-functions/dotnet-isolated:4 ENV AzureFunctionsJobHostLoggingConsole__IsEnabled=true \ DOTNET_RUNNING_IN_CONTAINER=true WORKDIR /home/site/wwwroot COPY . .

  1. Deploy container and verify the functions.metadata and the application dlls are all present in /home/site/wwroot.
  2. Check logs in container:

warn: Microsoft.AspNetCore.Server.Kestrel[0] Overriding address(es) 'http://+:80'. Binding to endpoints defined via IConfiguration and/or UseKestrel() instead. info: Microsoft.Hosting.Lifetime[14] Now listening on: http://127.0.0.1:37427 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production info: Microsoft.Hosting.Lifetime[0] Content root path: /home/site/wwwroot info: Host.Triggers.Warmup[0] Initializing Warmup Extension. info: Host.Startup[503] Initializing Host. OperationId: '76aa393f-2ef0-4071-8e71-1a32263d547c'. info: Host.Startup[504] Host initialization: ConsecutiveErrors=0, StartupCount=1, OperationId=76aa393f-2ef0-4071-8e71-1a32263d547c info: Microsoft.Azure.WebJobs.Hosting.OptionsLoggingService[0] LoggerFilterOptions { "MinLevel": "None", "Rules": [ { "ProviderName": null, "CategoryName": null, "LogLevel": null, "Filter": "b0" }, { "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider", "CategoryName": null, "LogLevel": "None", "Filter": null }, { "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider", "CategoryName": null, "LogLevel": null, "Filter": "b0" } ] } info: Microsoft.Azure.WebJobs.Hosting.OptionsLoggingService[0] ConcurrencyOptions { "DynamicConcurrencyEnabled": false, "MaximumFunctionConcurrency": 500, "CPUThreshold": 0.8, "SnapshotPersistenceEnabled": true } info: Microsoft.Azure.WebJobs.Hosting.OptionsLoggingService[0] FunctionResultAggregatorOptions { "BatchSize": 1000, "FlushTimeout": "00:00:30", "IsEnabled": true } info: Microsoft.Azure.WebJobs.Hosting.OptionsLoggingService[0] SingletonOptions { "LockPeriod": "00:00:15", "ListenerLockPeriod": "00:01:00", "LockAcquisitionTimeout": "10675199.02:48:05.4775807", "LockAcquisitionPollingInterval": "00:00:05", "ListenerLockRecoveryPollingInterval": "00:01:00" } info: Microsoft.Azure.WebJobs.Hosting.JobHostService[0] Starting JobHost info: Host.Startup[401] Starting Host (HostId=taosplatsvcsapiadminlinuxdeploym, InstanceId=9acf9ae3-c17b-488f-a051-3f2c177f13a9, Version=4.0.1.16815, ProcessId=1, AppDomainId=1, InDebugMode=False, InDiagnosticMode=False, FunctionsExtensionVersion=(null)) info: Host.Startup[314] Loading functions metadata info: Host.Startup[315] 0 functions loaded info: Host.Startup[0] Generating 0 job function(s) warn: Host.Startup[0] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.). info: Microsoft.Azure.WebJobs.Script.WebHost.WebScriptHostHttpRoutesManager[0] Initializing function HTTP routes No HTTP routes mapped

info: Microsoft.Azure.WebJobs.Hosting.OptionsLoggingService[0] HttpOptions { "DynamicThrottlesEnabled": false, "EnableChunkedRequestBinding": false, "MaxConcurrentRequests": -1, "MaxOutstandingRequests": -1, "RoutePrefix": "api" } info: Host.Startup[412] Host initialized (86ms) info: Host.Startup[413] Host started (97ms) info: Host.Startup[0] Job host started Hosting environment: Production Content root path: /home/site/wwwroot Now listening on: http://[::]:80 Application started. Press Ctrl+C to shut down. info: Host.General[337] Host lock lease acquired by instance ID '000000000000000000000000643EADBB'.

v-bbalaiagar commented 2 years ago

Tagging @lpapudippu / @kshyju for further investigation

lpapudippu commented 2 years ago

@jainharsh98 Can you please look in to it ?

lpapudippu commented 2 years ago

Adding @raorugan

jainharsh98 commented 2 years ago

@gurpreed Can you please mention the exact deployment method used in Step 4? There is an open issue with the func core tools regarding deployment of net6 isolated v4 image https://github.com/Azure/azure-functions-core-tools/issues/2789

cgillum commented 2 years ago

FWIW, I ran into a similar issue earlier today when running a Functions container locally in Docker. I don't have the logs anymore, but one issue I noticed was that extensions.json was missing some entries when I compared it to a build that was working correctly on my desktop. Rebuilding the container image fixed it for me, so it seems to be some kind of race condition.

davidmrdavid commented 1 month ago

I think I just got this error in this CI build: https://github.com/Azure/azure-functions-durable-extension/actions/runs/11116718185/job/30887475605