Azure / Azure/azure-functions-host

EventHubTrigger fails on message binding on runtime 2

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

Description

I have an EventHubTrigger function (.NET Standard 2.0) developed in Visual Studio that works correctly when running from VS, but fails when invoked on Azure platform [runtime 2.0.11776.0 (beta)]. The failure seems to be a parameter binding issue.

The IOT hub routes messages to the built-in events endpoint. I created a 'hotpath' consumer group.

#### Investigative information

Please provide the following:

- Timestamp: 2018-05-31 10:03:35.448
- Function App version (1.0 or 2.0-beta): 2.0-beta
- Function App name: GreatGuideFunctions
- Function name(s) (as appropriate): HandleDeviceEvent
- Invocation ID: 26f54247-4140-4c0d-b88f-4e25a5991bcf
- Region: South Central US

#### Repro steps
In VS on local PC:
1. Start debug session in VS
2.HTTP POST test message to IOT hub using the URL: https://<>.azure-devices.net/devices/CSS-TEST/messages/events?api-version=2016-02-03
2. Azure hosting environment displays the log message that message was processed

On Azure:
1. HTTP POST test message to IOT hub using the URL: https://<>.azure-devices.net/devices/CSS-TEST/messages/events?api-version=2016-02-03
2. Function logs report error executing the function

#### Expected behavior
Function should successfully execute on Azure as it does on local PC.

#### Actual behavior
Function execution on Azure fails with error:
Failure: Exception binding parameter 'myEventHubMessage'
Parameter: myEventHubMessage Value: Object reference not set to an instance of an object.

#### Known workarounds
None

#### Related information

Provide any related information

* Programming language used : C#
* Source: In details
* Bindings
function.json
{
"generatedBy": "Microsoft.NET.Sdk.Functions-1.0.13",
"configurationSource": "attributes",
"bindings": [
{
"type": "eventHubTrigger",
"eventHubName": "platformeventhub",
"consumerGroup": "hotpath",
"connection": "PlatformEventHub_events",
"name": "myEventHubMessage"
}
],
"disabled": false,
"scriptFile": "../bin/DeviceEvent.dll",
"entryPoint": "DeviceEvent.HandleDeviceEvent.Run"
}

Source
```csharp
public static class HandleDeviceEvent
{
[FunctionName("HandleDeviceEvent")]
public static void Run(
[EventHubTrigger("platformeventhub",Connection = "PlatformEventHub_events", ConsumerGroup = "hotpath")]string myEventHubMessage,
[Table("PlatformSummary")] CloudTable platformSummaries,
TraceWriter log)
{
log.Info($"Some message {DateTime.UtcNow}:{myEventHubMessage}");
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the reported function.json binding configuration and the HandleDeviceEvent.Run source in the issue, then investigate how the Azure Functions host handles the EventHubTrigger parameter on runtime 2.0.11776.0. Reproduce the Azure failure using the stated Event Hub, consumer group, and message flow; done means the binding succeeds on Azure as it does locally.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.