Azure / Azure/azure-functions-core-tools

Function App error on startup: WorkerConfig for runtime: custom not found

Open
#3,461 5 comments 4 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
5d 4h
Merged PRs (30d)
15

Description

## Description of issue

We deploy our Function Apps with Bicep templates. Our Function Apps are custom handlers (Go binary).

Whenever we deploy the Bicep template, this error occurs. I have tested at this point probably hundreds of different configuration combinations and it doesn't seem to make any difference to the result. This occurs consistently with all our Function Apps, which have very similar configurations.

This issue occurs in both of these scenarios:
* Custom handler deployed directly on Function App
* Custom container (occurs with all function app base images) deployed from ACR running the same custom handler

This error has been referenced before, mainly with dotnet-isolated it seems (e.g. [this](https://github.com/Azure/azure-functions-dotnet-worker/issues/810) and [this](https://github.com/Azure/azure-functions-core-tools/issues/2960)).

Also with one of our function apps, currently deployed as a custom container, we're seeing this error which I have not been able to reproduce elsewhere:
```
Microsoft.Azure.WebJobs.Script.ExternalStartupException : Error building configuration in an external startup class. ---> System.IO.IOException : The file '/home/data/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/3.24.0/extensions.csproj' already exists. at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo,String path,Boolean isDirectory,Func`2 errorRewriter) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path,OpenFlags flags,Int32 mode) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath,FileMode mode,FileAccess access,FileShare share,FileOptions options,Int64 preallocationSize) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path,FileMode mode,FileAccess access,FileShare share,FileOptions options,Int64 preallocationSize) at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream,String path,FileMode mode,FileAccess access,FileShare share,Int32 bufferSize,FileOptions options,Int64 preallocationSize) at System.IO.Compression.ZipFileExtensions.ExtractToFile(ZipArchiveEntry source,String destinationFileName,Boolean overwrite) at System.IO.Compression.ZipFileExtensions.ExtractRelativeToDirectory(ZipArchiveEntry source,String destinationDirectoryName,Boolean overwrite) at System.IO.Compression.ZipFileExtensions.ExtractToDirectory(ZipArchive source,String destinationDirectoryName,Boolean overwriteFiles) at System.IO.Compression.ZipFile.ExtractToDirectory(String sourceArchiveFileName,String destinationDirectoryName,Encoding entryNameEncoding,Boolean overwriteFiles) at async Microsoft.Azure.WebJobs.Script.ExtensionBundle.ExtensionBundleManager.DownloadExtensionBundleAsync(String version,HttpClient httpClient) at /src/azure-functions-host/src/WebJobs.Script/ExtensionBundle/ExtensionBundleManager.cs : 176 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.ExtensionBundle.ExtensionBundleManager.GetBundle(HttpClient httpClient) at /src/azure-functions-host/src/WebJobs.Script/ExtensionBundle/ExtensionBundleManager.cs : 110 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.ExtensionBundle.ExtensionBundleManager.GetExtensionBundlePath(??) at /src/azure-functions-host/src/WebJobs.Script/ExtensionBundle/ExtensionBundleManager.cs : 79 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.ExtensionBundle.ExtensionBundleManager.GetExtensionBundleBinPathAsync() at /src/azure-functions-host/src/WebJobs.Script/ExtensionBundle/ExtensionBundleManager.cs : 267 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.DependencyInjection.ScriptStartupTypeLocator.GetExtensionsStartupTypesAsync() at /src/azure-functions-host/src/WebJobs.Script/DependencyInjection/ScriptStartupTypeLocator.cs : 117 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Azure.WebJobs.Script.DependencyInjection.ScriptStartupTypeLocator.<.ctor>b__10_0() at /src/azure-functions-host/src/WebJobs.Script/DependencyInjection/ScriptStartupTypeLocator.cs : 53 at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication,Boolean useDefaultConstructor) at System.Lazy`1.CreateValue() at Microsoft.Azure.WebJobs.Script.DependencyInjection.ScriptStartupTypeLocator.GetStartupTypes() at /src/azure-functions-host/src/WebJobs.Script/DependencyInjection/ScriptStartupTypeLocator.cs : 68 at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.UseExternalConfigurationStartup(IWebJobsConfigurationBuilder builder,IWebJobsStartupTypeLocator startupTypeLocator,WebJobsBuilderContext context,ILoggerFactory loggerFactory) at D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsBuilderExtensions.cs : 362 at Microsoft.Azure.WebJobs.Script.ScriptHostBuilderExtensions.<>c__DisplayClass7_3.b__8(IWebJobsStartupTypeLocator locator) at /src/azure-functions-host/src/WebJobs.Script/ScriptHostBuilderExtensions.cs : 253 End of inner exception
```

## How to reproduce

1. Create a Bicep template to deploy a custom handler Function App. Configuration options don't really matter, as long as Azure accepts it as valid.
2. Deploy the template, then the function itself with e.g. `func azure functionapp publish`
3. Then deploy the Bicep template again.
4. Function App fails to start and throws this error.
5. Now you can get it running again by redeploying the function itself with `func azure functionapp publish`. Sometimes requires 2-3 deploys before the runtime recovers.

Contributor guide

Open the contributing guide

Research direction

Start with the issue's Bicep deployment sequence: deploy the custom-handler app, run `func azure functionapp publish`, redeploy the template, and capture the startup error. No repository file or test is named; done means the repeated template deployment no longer prevents startup or requires repeated function publishes to recover.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, go
Domain
cli, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.