Azure / Azure/azure-functions-host

The extensions.json file is often blank when QueueTrigger v4 AzFunction using .NET 6.

Open
#9,280 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

When building and running our Azure functions in Visual Studio 2022 locally, we usually receive these `not registered` errors.

```
[2023-05-18T16:09:18.135Z] Host started (2311ms)
[2023-05-18T16:09:18.142Z] Job host started
[2023-05-18T16:09:18.161Z] The 'Function2' function is in error: The binding type(s) 'queueTrigger' are not registered. Please ensure the type is correct and the binding extension is installed.
[2023-05-18T16:09:18.171Z] The 'Function3' function is in error: The binding type(s) 'queue' are not registered. Please ensure the type is correct and the binding extension is installed.
```

We're using DI for a number of services within our Azure functions (including `GraphServiceClient`). Per the error, we've triple checked that the `Microsoft.Azure.WebJobs.Extensions.Storage` package is installed. We've tried downgrading to v4.0.5 of this package, but the symptoms persist. Here is our csproj file housing the Azure functions:

```


net6.0
v4
















PreserveNewest


PreserveNewest
Never







```

One of our functions looks like this:
```csharp
public class Function2
{
private readonly ILogger logger;

public Function2(ILogger logger)
{
this.logger = logger;
}

[FunctionName("Function2")]
public async Task Run([QueueTrigger("%AzureStorageQueueName%", Connection = "CONNECTIONSTRING")] string myQueueItem)
{
logger.LogInformation($"Received notifications: {myQueueItem}");
}
}
```

When this occasionally works, the `extensions.json` file in the output directory will be populated, and all of the Azure functions properly register their bindings:

```
{
"extensions":[
{ "name": "AzureStorage", "typeName":"Microsoft.Azure.WebJobs.Extensions.Storage.AzureStorageWebJobsStartup, Microsoft.Azure.WebJobs.Extensions.Storage, Version=5.1.2.0, Culture=neutral, PublicKeyToken="},
{ "name": "Startup", "typeName":"T2.Functions.Startup, T2FunctionApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken="}
]
}
```

However, usually the `extensions.json` file appears blank as:

```
{
"extensions":[
]
}
```

#### Investigative information

- Timestamp: Today
- Function App version: v4
- Function App name: Functions
- Function name(s) (as appropriate): Function3
- Invocation ID: N/A - running locally
- Region: N/A

Contributor guide

Open the contributing guide

Research direction

Start with the provided .csproj, especially the custom ZipFunctions target and its _GenerateFunctionsExtensionsMetadataPostBuild and _GenerateFunctionsPostBuild dependencies. Reproduce a local Visual Studio build and inspect the generated extensions.json in the output directory; done means the file consistently contains the AzureStorage and Startup entries so queue bindings register.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.