func start errors when there is a CONTAINER_NAME app setting
Version
4.0.6610
Description
When running locally via func start and there is a settings key named CONTAINER_NAME, the host fails to start with an error like this
2025-01-10T18:49:46.653Z] A host error has occurred during startup operation '93b5a6ad-ec94-4ec1-ba40-6ea947e3d854'.
[2025-01-10T18:49:46.658Z] Microsoft.AspNetCore.DataProtection: An error occurred while trying to encrypt the provided data. Refer to the inner exception for more information. Microsoft.AspNetCore.DataProtection: The key ring does not contain a valid default protection key. The data protection system cannot create a new key because auto-generation of keys is disabled. For more information go to https://aka.ms/aspnet/dataprotectionwarning.
or in another example this error:
MS_FUNCTION_LOGS 5,,,,,ScriptApplicationHostOptionsSetup,"","ScmRunFromPackage is empty.",4.1036.1.23224,2025-01-10T19:19:44.1367206Z,,"",,,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","Workers Directory set to: C:\Users\mimcke\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers",4.1036.1.23224,2025-01-10T19:19:44.3978729Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","Found worker config: C:\Users\mimcke\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\java\worker.config.json",4.1036.1.23224,2025-01-10T19:19:44.3984380Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","EnvironmentVariable FUNCTIONS_WORKER_RUNTIME: dotnet-isolated",4.1036.1.23224,2025-01-10T19:19:44.3995780Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 4,,,,,Host.LanguageWorkerConfig,"","FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: java",4.1036.1.23224,2025-01-10T19:19:44.4001866Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_AZURE_MONITOR_EVENT 4,localhost:7071,Microsoft.Web/sites/functions/log,FunctionAppLogs,,"{'appName':'','roleInstance':'raw','message':'FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: java','category':'Host.LanguageWorkerConfig','hostVersion':'4.1036.1.23224','hostInstanceId':'f3f013ad-7efe-452a-b409-57a1256ad93b','level':'Information','levelId':2,'processId':5364}",RAW,,1/10/2025 7:19:44 PM
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","Found worker config: C:\Users\mimcke\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\node\worker.config.json",4.1036.1.23224,2025-01-10T19:19:44.4074404Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","EnvironmentVariable FUNCTIONS_WORKER_RUNTIME: dotnet-isolated",4.1036.1.23224,2025-01-10T19:19:44.4083169Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 4,,,,,Host.LanguageWorkerConfig,"","FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: node",4.1036.1.23224,2025-01-10T19:19:44.4085027Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_AZURE_MONITOR_EVENT 4,localhost:7071,Microsoft.Web/sites/functions/log,FunctionAppLogs,,"{'appName':'','roleInstance':'raw','message':'FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: node','category':'Host.LanguageWorkerConfig','hostVersion':'4.1036.1.23224','hostInstanceId':'f3f013ad-7efe-452a-b409-57a1256ad93b','level':'Information','levelId':2,'processId':5364}",RAW,,1/10/2025 7:19:44 PM
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","Found worker config: C:\Users\mimcke\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\powershell\worker.config.json",4.1036.1.23224,2025-01-10T19:19:44.4088870Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","EnvironmentVariable FUNCTIONS_WORKER_RUNTIME: dotnet-isolated",4.1036.1.23224,2025-01-10T19:19:44.4096310Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 4,,,,,Host.LanguageWorkerConfig,"","FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: powershell",4.1036.1.23224,2025-01-10T19:19:44.4096555Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_AZURE_MONITOR_EVENT 4,localhost:7071,Microsoft.Web/sites/functions/log,FunctionAppLogs,,"{'appName':'','roleInstance':'raw','message':'FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: powershell','category':'Host.LanguageWorkerConfig','hostVersion':'4.1036.1.23224','hostInstanceId':'f3f013ad-7efe-452a-b409-57a1256ad93b','level':'Information','levelId':2,'processId':5364}",RAW,,1/10/2025 7:19:44 PM
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","Found worker config: C:\Users\mimcke\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.config.json",4.1036.1.23224,2025-01-10T19:19:44.4098235Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","EnvironmentVariable FUNCTIONS_WORKER_RUNTIME: dotnet-isolated",4.1036.1.23224,2025-01-10T19:19:44.4104689Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 4,,,,,Host.LanguageWorkerConfig,"","FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: python",4.1036.1.23224,2025-01-10T19:19:44.4104966Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_AZURE_MONITOR_EVENT 4,localhost:7071,Microsoft.Web/sites/functions/log,FunctionAppLogs,,"{'appName':'','roleInstance':'raw','message':'FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: python','category':'Host.LanguageWorkerConfig','hostVersion':'4.1036.1.23224','hostInstanceId':'f3f013ad-7efe-452a-b409-57a1256ad93b','level':'Information','levelId':2,'processId':5364}",RAW,,1/10/2025 7:19:44 PM
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","Found worker config: C:\Users\mimcke\OneDrive\source\repos\deleteme\fail_func\bin\output\worker.config.json",4.1036.1.23224,2025-01-10T19:19:44.4107190Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","EnvironmentVariable FUNCTIONS_WORKER_RUNTIME: dotnet-isolated",4.1036.1.23224,2025-01-10T19:19:44.4114375Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","EnvironmentVariable FUNCTIONS_WORKER_RUNTIME_VERSION: ",4.1036.1.23224,2025-01-10T19:19:44.4120122Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","Added WorkerConfig for language: dotnet-isolated",4.1036.1.23224,2025-01-10T19:19:44.4130035Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","Workers Directory set to: C:\Users\mimcke\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers",4.1036.1.23224,2025-01-10T19:19:44.4131665Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","Found worker config: C:\Users\mimcke\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\java\worker.config.json",4.1036.1.23224,2025-01-10T19:19:44.4133707Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","EnvironmentVariable FUNCTIONS_WORKER_RUNTIME: dotnet-isolated",4.1036.1.23224,2025-01-10T19:19:44.4141432Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 4,,,,,Host.LanguageWorkerConfig,"","FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: java",4.1036.1.23224,2025-01-10T19:19:44.4141642Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_AZURE_MONITOR_EVENT 4,localhost:7071,Microsoft.Web/sites/functions/log,FunctionAppLogs,,"{'appName':'','roleInstance':'raw','message':'FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: java','category':'Host.LanguageWorkerConfig','hostVersion':'4.1036.1.23224','hostInstanceId':'f3f013ad-7efe-452a-b409-57a1256ad93b','level':'Information','levelId':2,'processId':5364}",RAW,,1/10/2025 7:19:44 PM
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","Found worker config: C:\Users\mimcke\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\node\worker.config.json",4.1036.1.23224,2025-01-10T19:19:44.4143358Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","EnvironmentVariable FUNCTIONS_WORKER_RUNTIME: dotnet-isolated",4.1036.1.23224,2025-01-10T19:19:44.4149209Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 4,,,,,Host.LanguageWorkerConfig,"","FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: node",4.1036.1.23224,2025-01-10T19:19:44.4149419Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_AZURE_MONITOR_EVENT 4,localhost:7071,Microsoft.Web/sites/functions/log,FunctionAppLogs,,"{'appName':'','roleInstance':'raw','message':'FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: node','category':'Host.LanguageWorkerConfig','hostVersion':'4.1036.1.23224','hostInstanceId':'f3f013ad-7efe-452a-b409-57a1256ad93b','level':'Information','levelId':2,'processId':5364}",RAW,,1/10/2025 7:19:44 PM
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","Found worker config: C:\Users\mimcke\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\powershell\worker.config.json",4.1036.1.23224,2025-01-10T19:19:44.4150634Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","EnvironmentVariable FUNCTIONS_WORKER_RUNTIME: dotnet-isolated",4.1036.1.23224,2025-01-10T19:19:44.4156767Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 4,,,,,Host.LanguageWorkerConfig,"","FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: powershell",4.1036.1.23224,2025-01-10T19:19:44.4156966Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_AZURE_MONITOR_EVENT 4,localhost:7071,Microsoft.Web/sites/functions/log,FunctionAppLogs,,"{'appName':'','roleInstance':'raw','message':'FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: powershell','category':'Host.LanguageWorkerConfig','hostVersion':'4.1036.1.23224','hostInstanceId':'f3f013ad-7efe-452a-b409-57a1256ad93b','level':'Information','levelId':2,'processId':5364}",RAW,,1/10/2025 7:19:44 PM
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","Found worker config: C:\Users\mimcke\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.config.json",4.1036.1.23224,2025-01-10T19:19:44.4158448Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","EnvironmentVariable FUNCTIONS_WORKER_RUNTIME: dotnet-isolated",4.1036.1.23224,2025-01-10T19:19:44.4162818Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 4,,,,,Host.LanguageWorkerConfig,"","FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: python",4.1036.1.23224,2025-01-10T19:19:44.4163004Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_AZURE_MONITOR_EVENT 4,localhost:7071,Microsoft.Web/sites/functions/log,FunctionAppLogs,,"{'appName':'','roleInstance':'raw','message':'FUNCTIONS_WORKER_RUNTIME set to dotnet-isolated. Skipping WorkerConfig for language: python','category':'Host.LanguageWorkerConfig','hostVersion':'4.1036.1.23224','hostInstanceId':'f3f013ad-7efe-452a-b409-57a1256ad93b','level':'Information','levelId':2,'processId':5364}",RAW,,1/10/2025 7:19:44 PM
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","Found worker config: C:\Users\mimcke\OneDrive\source\repos\deleteme\fail_func\bin\output\worker.config.json",4.1036.1.23224,2025-01-10T19:19:44.4165481Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","EnvironmentVariable FUNCTIONS_WORKER_RUNTIME: dotnet-isolated",4.1036.1.23224,2025-01-10T19:19:44.4172050Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","EnvironmentVariable FUNCTIONS_WORKER_RUNTIME_VERSION: ",4.1036.1.23224,2025-01-10T19:19:44.4172695Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 5,,,,,Host.LanguageWorkerConfig,"","Added WorkerConfig for language: dotnet-isolated",4.1036.1.23224,2025-01-10T19:19:44.4173482Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 4,,,,,Host.Triggers.Warmup,"","Initializing Warmup Extension.",4.1036.1.23224,2025-01-10T19:19:44.4671607Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_AZURE_MONITOR_EVENT 4,localhost:7071,Microsoft.Web/sites/functions/log,FunctionAppLogs,,"{'appName':'','roleInstance':'raw','message':'Initializing Warmup Extension.','category':'Host.Triggers.Warmup','hostVersion':'4.1036.1.23224','hostInstanceId':'f3f013ad-7efe-452a-b409-57a1256ad93b','level':'Information','levelId':2,'processId':5364}",RAW,,1/10/2025 7:19:44 PM
MS_FUNCTION_LOGS 5,,,,,Microsoft.Azure.WebJobs.Host.IDistributedLockManager,"","Using BlobLeaseDistributedLockManager",4.1036.1.23224,2025-01-10T19:19:44.4831451Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 4,,,,Initializing,Host.Startup,"","Initializing Host. OperationId: 'f1392de7-1d45-4527-ad5b-0f2028437c4b'.",4.1036.1.23224,2025-01-10T19:19:44.4997146Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_AZURE_MONITOR_EVENT 4,localhost:7071,Microsoft.Web/sites/functions/log,FunctionAppLogs,,"{'appName':'','roleInstance':'raw','message':'Initializing Host. OperationId: f1392de7-1d45-4527-ad5b-0f2028437c4b.','category':'Host.Startup','hostVersion':'4.1036.1.23224','hostInstanceId':'f3f013ad-7efe-452a-b409-57a1256ad93b','level':'Information','levelId':2,'processId':5364,'eventId':503,'eventName':'Initializing'}",RAW,,1/10/2025 7:19:44 PM
MS_FUNCTION_LOGS 4,,,,Initialization,Host.Startup,"","Host initialization: ConsecutiveErrors=0, StartupCount=1, OperationId=f1392de7-1d45-4527-ad5b-0f2028437c4b",4.1036.1.23224,2025-01-10T19:19:44.5053157Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_AZURE_MONITOR_EVENT 4,localhost:7071,Microsoft.Web/sites/functions/log,FunctionAppLogs,,"{'appName':'','roleInstance':'raw','message':'Host initialization: ConsecutiveErrors=0, StartupCount=1, OperationId=f1392de7-1d45-4527-ad5b-0f2028437c4b','category':'Host.Startup','hostVersion':'4.1036.1.23224','hostInstanceId':'f3f013ad-7efe-452a-b409-57a1256ad93b','level':'Information','levelId':2,'processId':5364,'eventId':504,'eventName':'Initialization'}",RAW,,1/10/2025 7:19:44 PM
MS_FUNCTION_LOGS 5,,,,LogHostInitializationSettings,Host.Startup,"","{ 'OriginalFunctionWorkerRuntime': 'dotnet-isolated', 'FunctionsWorkerRuntime': 'dotnet-isolated', 'OriginalFunctionWorkerRuntimeVersion': null, 'FunctionsWorkerRuntimeVersion': null, 'FunctionsExtensionVesion': null, 'HostDirectory': 'C:\\Users\\mimcke\\OneDrive\\source\\repos\\deleteme\\fail_func\\bin\\output', 'InStandbyMode': false, 'HasBeenSpecialized': false, 'UsePlaceholderDotNetIsolated': false, 'WebSiteSku': null, 'FeatureFlags': null, 'HostingConfig': {}, 'HISMode': 'Disabled' }",4.1036.1.23224,2025-01-10T19:19:44.5381752Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_LOGS 2,,,,,Host.Startup,"","Unable to load the functions payload since the app was not provisioned with valid AzureWebJobsStorage connection string.",4.1036.1.23224,2025-01-10T19:19:44.5384806Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_AZURE_MONITOR_EVENT 2,localhost:7071,Microsoft.Web/sites/functions/log,FunctionAppLogs,,"{'appName':'','roleInstance':'raw','message':'Unable to load the functions payload since the app was not provisioned with valid AzureWebJobsStorage connection string.','category':'Host.Startup','hostVersion':'4.1036.1.23224','hostInstanceId':'f3f013ad-7efe-452a-b409-57a1256ad93b','level':'Error','levelId':4,'processId':5364}",RAW,,1/10/2025 7:19:44 PM
[2025-01-10T19:19:44.538Z] Unable to load the functions payload since the app was not provisioned with valid AzureWebJobsStorage connection string.
MS_FUNCTION_LOGS 4,,,,FunctionMetadataManagerLoadingFunctionsMetadata,Host.Startup,"","Loading functions metadata",4.1036.1.23224,2025-01-10T19:19:44.5530248Z,,"",,f3f013ad-7efe-452a-b409-57a1256ad93b,,RAW,,,,
MS_FUNCTION_AZURE_MONITOR_EVENT 4,localhost:7071,Microsoft.Web/sites/functions/log,FunctionAppLogs,,"{'appName':'','roleInstance':'raw','message':'Loading functions metadata','category':'Host.Startup','hostVersion':'4.1036.1.23224','hostInstanceId':'f3f013ad-7efe-452a-b409-57a1256ad93b','level':'Information','levelId':2,'processId':5364,'eventId':314,'eventName':'FunctionMetadataManagerLoadingFunctionsMetadata'}",RAW,,1/10/2025 7:19:44 PM
[2025-01-10T19:19:44.573Z] Error while assigning execute permission.
[2025-01-10T19:19:44.574Z] Mono.Posix.NETStandard: Unable to find an entry point named 'Mono_Posix_Syscall_getcwd' in DLL 'MonoPosixHelper'.
If this settings key is renamed, such as in my example RAW_CONTAINER_NAME, this error goes away.
Steps to reproduce
To reproduce the first error, build this GitHub repo: https://github.com/mmckechney/semantic_kernel_askq. This code has a function project named DocumentQuestionsFunction. When there is a local.settings.json key of CONTAINER_NAME it gives the DataProtection error.
For the second error, you can create a new function project using:
func init --worker-runtime dotnet-isolated --target-framework net8.0
func function new --language C# --template blobtrigger --name funcRepro
edit the local.settings.json file to add a new item CONTAINER_NAME and add any value, but don't leave it empty
then start the function with func start and you will experience the second error.
+1
+1
+1. someone else had noticed this couple years back too. obscure issue causing a lot of confusion -- especially when working with blob trigger
CONTAINER_NAME is used by the host to determine if it is running in a linux environment:
https://github.com/Azure/azure-functions-host/blob/c62778b79e53786dce2852a39b9c1c73690be651/src/WebJobs.Script/Environment/EnvironmentExtensions.cs#L323-L341
So when you set CONTAINER_NAME in your app settings, the host registers some additional services:
[2025-07-30T22:17:54.485Z] Initializing LinuxContainerActivityPublisher
[2025-07-30T22:17:54.485Z] Starting LinuxContainerActivityPublisher
And so things start to break:
[2025-07-30T22:18:00.587Z] PublishSpecializationCompleteEvent failed with System.InvalidOperationException: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
[2025-07-30T22:18:00.587Z] at System.Net.Http.HttpClient.PrepareRequestMessage(HttpRequestMessage request)
[2025-07-30T22:18:00.587Z] at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
[2025-07-30T22:18:00.587Z] at Microsoft.Azure.WebJobs.Script.WebHost.Management.MeshServiceClient.SendAsync(IEnumerable`1 formData) in /_/src/WebJobs.Script.WebHost/Management/MeshServiceClient.cs:line 154
[2025-07-30T22:18:00.587Z] at Microsoft.Azure.WebJobs.Script.WebHost.Management.MeshServiceClient.NotifyHealthEvent(ContainerHealthEventType healthEventType, Type source, String details) in /_/src/WebJobs.Script.WebHost/Management/MeshServiceClient.cs:line 104
[2025-07-30T22:18:00.587Z] at Microsoft.Azure.WebJobs.Script.WebHost.ContainerManagement.LinuxContainerActivityPublisher.PublishSpecializationCompleteEvent() in /_/src/WebJobs.Script.WebHost/ContainerManagement/LinuxContainerActivityPublisher.cs:line 122
[2025-07-30T22:18:26.387Z] Failed to publish status to /memoryactivity
[2025-07-30T22:18:26.387Z] System.Private.Uri: Invalid URI: The hostname could not be parsed.
If it was only LinuxContainerActivityPublisher I would just use DI to replace it, but there are so many linux specific settings and configurations for the host which makes this complicated. It may also break scenarios where the CLI is running in a linux container? So I advice you just stay away from that setting.
What we can do is log a warning or error if you try to use CONTAINER_NAME and let you know its protected.