-
Notifications
You must be signed in to change notification settings - Fork 19
Error with v4 EventHub trigger and cardinality many #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @rvk86 this is somewhat of a known problem, tracked by Azure/azure-functions-eventhubs-extension#118 The recommended workarounds are to either make sure your event hub messages are JSON-parseable or to add |
Hi @ejizba, thanks for your response. Since my messages are in Avro format, your first workaround is not feasible. I'd love to try the second, but with the v4 programming model I wouldn't know where to define the dataType. Can you help me with that? |
Try this: app.eventHub("location-updates", {
eventHubName: process.env.EVENT_HUB_NAME,
connection: "EVENT_HUB_CONNECTION",
handler: eventHubTrigger,
cardinality: "many", // if this is set to "one" the trigger works fine
dataType: "string",
}); We don't have full support for "dataType" yet in the TypeScript types (tracked here), but functionality-wise it should work. If TypeScript complains, casting the options object to "any" is an easy way to suppress the error: app.eventHub("location-updates", <any>{ |
specifying the Thanks for your help :) |
Nice! Closing in favor of #72 and Azure/azure-functions-eventhubs-extension#118 |
I'm upgrading my EventHub trigger to the v4 programming model. When I run the trigger locally and publishing a message the code works fine with
cardinality: "one"
, but when I switch tocardinality: "many"
I'm receiving the following error:Repro steps
func start
Expected behavior
I'd expect the handler function to run with an array of strings as the first argument.
Actual behavior
The emulator throws the error as shown above
The text was updated successfully, but these errors were encountered: