Closed mhoeger closed 3 months ago
The fix involves creating a DefaultType for the EventHubs trigger attribute and making sure that it is registered in the metadata provider
cc: @pragnagopa
Hi, I've having the same issue while using Typescript v4. And i dont find a way to specify the dataType. I need to work with binary data.
Code :
export async function LiveData(messages: any | any[], context: InvocationContext): Promise<void> {
// ...
}
app.eventHub('LiveData', {
connection: 'Connection',
eventHubName: 'messages/events',
cardinality: 'many',
consumerGroup: '%EventHubConsumerGroup%',
handler: LiveData,
});
Error:
[Error] Executed 'Functions.LiveData' (Failed, Id=, Duration=84ms)
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: ⸮. Path '', line 0, position 0.
When "cardinality": "many" is set on an Event Hubs trigger (as it should be for best perf), the error below is thrown unless the original input is valid json. This conflicts with v1 behavior and breaks the template example
Workaround: If you know your input may not be valid json, add "dataType": "string" to trigger binding. Example function.json:
Complete stack trace
Additional context: PR with first pass at fix: https://github.com/Azure/azure-functions-host/pull/3170 Issue was brought to attention here: https://github.com/Azure/azure-functions-host/issues/2815