At first I upgraded the package "Microsoft.Azure.Functions.Worker.Extensions.EventHubs" from version 4.3.0 to 5.1.0.
and I upgraded from the deprecated Microsoft.Azure.EventHubs package to Azure.Messaging.EventHubs.
Then I run the C# function that return the error: ‘Azure.Messaging.EventHubs: The path to an Event Hub may be specified as part of the connection string or as a separate value, but not both. Please verify that your connection string does not have the EntityPath
token if you are passing an explicit Event Hub name. (Parameter ‘connectionString’).‘
I have this settings
and checked the EntityPath in connectionString is the same as the EventhubName.
My code:
[FunctionName("FilterFunctionEventhubTrigger")]
public async Task Run(
[EventHubTrigger(
"EventhubName",
Connection = "EventhubConnection",
ConsumerGroup = "%ConsumerGroup%")] EventData[] events, ILogger log)
{ ... }
Why the low version not return this error?
What need I do to solve this error?
2
Answers
I solved this error by change the 'Eventhubname' to use appsettings bindings.
to
more information form https://github.com/Azure/azure-functions-core-tools/issues/3034
Remove the
EntityPath=abc
part from your connection string.I think this error is to remove the situation where it would be ambiguous which one to use.
Of course in your case the value is the same, but they have done a simpler implementation where they throw an error if the event hub name is specified in different places.