Azure / Azure/azure-functions-host

All functions of same type are indexed even after defining an allow list

Open
#8,603 0 comments 0 reactions 0 assignees View on GitHub
Needs: Triage (Functions)
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 10h
Merged PRs (30d)
36

Description

We have different azure functions defined with the same type. In the deployment environment, we define an allow list with some of these functions (not all) using the environment variable ```AzureFunctionsJobHost__functions__X```.
In this case, all functions are indexed. We can check this through the following logs:
```
info: Host.Startup[0]
A function allow list has been specified, excluding all but the following functions: [DurableFunc_HttpStart]
info: Host.Startup[315]
1 functions loaded
info: Host.Startup[0]
Generating 1 job function(s)
info: Host.Startup[0]
Found the following functions:
durableFunctions.DurableFunc.HttpStart
durableFunctions.DurableFunc.RunOrchestrator
durableFunctions.DurableFunc.SayHello
```
The following error occurs in this case:
```
System.InvalidOperationException: Unable to load metadata for function 'DurableFunc'.
at Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.FunctionInstanceLogger.StartFunction(FunctionInstanceLogEntry item) in /src/azure-functions-host/src/WebJobs.Script.WebHost/Diagnostics/FunctionInstanceLogger.cs:line 74
at Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.FunctionInstanceLogger.AddAsync(FunctionInstanceLogEntry item, CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script.WebHost/Diagnostics/FunctionInstanceLogger.cs:line 52
at Microsoft.Azure.WebJobs.Host.Loggers.CompositeFunctionEventCollector.AddAsync(FunctionInstanceLogEntry item, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Loggers\CompositeFunctionEventCollector.cs:line 21
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 106
```

#### Investigative information

Please provide the following:

- Timestamp: N/A
- Function App version: 3.0.11
- Function App name: N/A
- Function name(s) (as appropriate):N/A
- Invocation ID: N/A
- Region: N/A

#### Repro steps
1. Create a .NET Durable functions app using core tools
2. Deploy it to K8s environment using func core tools
3. Invoke the function using HTTP Trigger.

#### Expected behavior

This error should not occur. Only the function specified in the allow list must be loaded.

#### Actual behavior

The host tries to load the function which is not part of allow list which causes the error.

#### Known workarounds

Make sure that the type of function is different.

#### Related information

Provide any related information

* Programming language used: Dotnet
* Links to source: Not relevant.
* Bindings used: Durable Functions

Related github issue: https://github.com/Azure/azure-functions-durable-extension/issues/2110

Contributor guide

Open the contributing guide

Research direction

Start by tracing the AzureFunctionsJobHost__functions__X allow-list handling in the host, then inspect Microsoft.Azure.WebJobs.Script.WebHost/Diagnostics/FunctionInstanceLogger.cs at the reported failure. Reproduce the .NET Durable Functions scenario with multiple functions sharing a type and verify that only the allow-listed function is indexed and invoked without the metadata error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.