Azure / Azure/azure-functions-dotnet-worker

Unable to get PartitionContext for eventhub trigger

Open
#2,293 2 comments 4 reactions 0 assignees View on GitHub
extensions: event-hubs needs-investigation potential-bug
Dominant language
C#
Stars
466
Forks
215
Avg merge
3d 10h
Merged PRs (30d)
7

Description

### Description

**Description**
Using an EventHub triggered function with PartitionContext as parameter causes an error:

> Exception: Microsoft.Azure.Functions.Worker.FunctionInputConverterException: Error converting 1 input parameters for Function 'LanderInitial': Cannot convert input parameter 'partitionContext' to type 'Azure.Messaging.EventHubs.Consumer.PartitionContext' from type 'System.String'. Error:System.NotSupportedException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'Azure.Messaging.EventHubs.Consumer.PartitionContext'. Path: $ | LineNumber: 0 | BytePositionInLine: 1.

```
[Function("LanderInitial")]
[FixedDelayRetry(1, "00:00:30")]
public async Task Run(
[EventHubTrigger(
eventHubName: "ingestion",
Connection = "IngestionEventHubConnStr",
ConsumerGroup = "lander-initial",
IsBatched = false)]
EventData myEventHubMessage,
Microsoft.Azure.WebJobs.ExecutionContext exeContext,
PartitionContext partitionContext)
{
```

The versions I am using are as follows:
```

```

### Steps to reproduce

Try to use PartitionContext as parameter in azure function with eventhub trigger

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the EventHub-triggered function using the shown PartitionContext parameter and package versions, then trace the reported FunctionInputConverterException and its input-conversion path. Done means the function accepts PartitionContext without attempting unsupported string deserialization, with the behavior verified against the reproduction example.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.