Azure / Azure/azure-functions-templates
Default EventHubTrigger template fails to handle events
- Dominant language
- C#
- Stars
- 363
- Forks
- 206
- Avg merge
- 15m
- Merged PRs (30d)
- 1
Description
When you create a default EventHubTrigger function in the Azure portal, it's unable to properly handle events. It throws the following error:
```
2019-07-16T01:00:50.761 [Error] Executed 'Functions.EventHubTrigger1' (Failed, Id=6c60990e-cdf6-4eaa-896c-8caef21cc63a)
Binding parameters to complex objects (such as 'Object') uses Json.NET serialization.
1. Bind the parameter type as 'string' instead of 'Object' to get the raw values and avoid JSON deserialization, or
2. Change the queue payload to be valid json. The JSON parser failed: Unexpected character encountered while parsing value: T. Path '', line 0, position 0.
```
If you remove the "Test message" payload, it throws the following:
```
2019-07-16T01:04:14.912 [Error] Function compilation error
Microsoft.CodeAnalysis.Scripting.CompilationErrorException : Script compilation failed.
at async Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.CreateFunctionTarget(CancellationToken cancellationToken) at C:\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\DotNetFunctionInvoker.cs : 314
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Script.Description.FunctionLoader`1.GetFunctionTargetAsync[T](Int32 attemptCount) at C:\azure-webjobs-sdk-script\src\WebJobs.Script\Description\FunctionLoader.cs : 55
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.GetFunctionTargetAsync(Boolean isInvocation) at C:\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\DotNetFunctionInvoker.cs : 183
2019-07-16T01:04:15.009 [Error] run.csx(1,1): error CS0006: Metadata file 'Microsoft.Azure.EventHubs' could not be found
2019-07-16T01:04:15.041 [Error] run.csx(5,23): error CS0234: The type or namespace name 'EventHubs' does not exist in the namespace 'Microsoft.Azure' (are you missing an assembly reference?)
2019-07-16T01:04:15.095 [Error] run.csx(7,30): error CS0246: The type or namespace name 'EventData' could not be found (are you missing a using directive or an assembly reference?)
2019-07-16T01:04:15.172 [Error] run.csx(11,14): error CS0246: The type or namespace name 'EventData' could not be found (are you missing a using directive or an assembly reference?)
2019-07-16T01:04:15.212 [Error] Executed 'Functions.EventHubTrigger1' (Failed, Id=8067e551-2155-4e1e-b7c0-7a6731092665)
Script compilation failed.
```
As a workaround, this can be fixed by changing the line
`#r "Microsoft.Azure.EventHubs"`
to
`#r "..\bin\Microsoft.Azure.EventHubs.dll"`
Some investigation is required to determine why the dll needs to be referenced directly in order to work.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.