Azure / Azure-Functions

1.12k stars 199 forks source link

Functions V2 - EventHubTrigger - Unable to Start #1299

Open grik001 opened 5 years ago

grik001 commented 5 years ago

Hi,

I am facing the below error when trying to start my azure functions. The runtime for my azure functions is .netstandard 2.0.

My scenario is this: I have a common library(.netstandard) and 2 azure functions. 1 of the functions has an EventHubTrigger and all was working well. After I add "Microsoft.Azure.Eventhubs" to the common library the below error starts occurring. The reason I need this library is because function 2 posts to EH. I have then attempted to remove the library and F1 starting working normally.

The listener for function 'xxx' was unable to start.
[13-Aug-19 16:27:51] The listener for function 'xxx' was unable to start. Microsoft.Azure.EventHubs.Processor: Encountered error while fetching the list of EventHub PartitionIds. Microsoft.Azure.EventHubs.Processor: Method not found: 'Microsoft.Azure.EventHubs.EventHubClient Microsoft.Azure.EventHubs.EventHubClient.Create(System.Uri, System.String, Microsoft.Azure.EventHubs.ITokenProvider, System.Nullable`1<System.TimeSpan>, Microsoft.Azure.EventHubs.TransportType)'.
kjohann commented 5 years ago

I just had a similar issue. Microsoft.Azure.WebJobs.Extensions.EventHubs depends on version 3.0.0 of Microsoft.Azure.EventHubs, but I have two other referenced projects using version 4.1.0. Launching the app then gives the exact same error message as you describe. A workaround that seems to be working for now is installing version 3.0.0 of Microsoft.Azure.EventHubs directly in the functions-project.

vijayalaya commented 4 years ago

I had this same issue in one of the QA enviornment ,but event hub trigger works in dev. Checked the connectionstring of eventhub and downgraded the Microsoft.Azure.WebJobs.Extensions.EventHubs to version 3.0.0, but still messages are not picked up. Any idea on this

dannymyers commented 4 years ago

This is still an issue even after upgrading to Azure Functions V3. Any updates? It's been open for over 6 months at this point.

oystein-devicedrive commented 4 years ago

I had the same issue today. I resolved it by adding Microsoft.Azure.WebJobs.Extensions.EventHubs instead of Microsoft.Azure.EventHubs. For some reason the error keeps coming when adding Microsoft.Azure.EventHubs directly.

fusionet24 commented 4 years ago

Had the same issue today. As said you need to use the Microsoft.Azure.WebJobs.Extensions.EventHubs. If you do need to use Microsoft.Azure.EventHubs say in depedent project then make sure it is 3.0.0.

It would be really good if MS could address this.

For reference this was an issue for us in Functions V3 not just V2.

pascalnaber commented 4 years ago

I'm also facing this issue in a v3 Azure Function.

I've referenced Microsoft.Azure.WebJobs.Extensions.EventHubs v4.1.1 Visual Studio tells me this is referencing Microsoft.Azure.EventHubs v3.0.0 (via Microsoft.Azure.EventHubs.Processor)

But nuget tells me it is referencing 4.2 (https://www.nuget.org/packages/Microsoft.Azure.EventHubs.Processor/)

I tried:

The azure function runs on my machine flawless. But in Azure I get:

Microsoft.Azure.WebJobs.Host.Listeners.FunctionListenerException: The listener for function 'EventHubTriggeredProcessor' was unable to start. ---> Microsoft.Azure.EventHubs.Processor.EventProcessorConfigurationException: Encountered error while fetching the list of EventHub PartitionIds ---> System.MissingMethodException: Method not found: 'Microsoft.Azure.EventHubs.EventHubClient Microsoft.Azure.EventHubs.EventHubClient.Create(System.Uri, System.String, Microsoft.Azure.EventHubs.ITokenProvider, System.Nullable`1, Microsoft.Azure.EventHubs.TransportType)'. at Microsoft.Azure.EventHubs.Processor.EventProcessorHost.CreateEventHubClient() at Microsoft.Azure.EventHubs.Processor.PartitionManager.GetPartitionIdsAsync() --- End of inner exception stack trace --- at Microsoft.Azure.EventHubs.Processor.PartitionManager.GetPartitionIdsAsync() at Microsoft.Azure.EventHubs.Processor.PartitionManager.GetPartitionIdsAsync() at Microsoft.Azure.EventHubs.Processor.PartitionManager.InitializeStoresAsync() at Microsoft.Azure.EventHubs.Processor.PartitionManager.StartAsync() at Microsoft.Azure.EventHubs.Processor.EventProcessorHost.RegisterEventProcessorFactoryAsync(IEventProcessorFactory factory, EventProcessorOptions processorOptions) at Microsoft.Azure.WebJobs.EventHubs.EventHubListener.StartAsync(CancellationToken cancellationToken) at Microsoft.Azure.WebJobs.Host.Listeners.FunctionListener.StartAsync(CancellationToken cancellationToken, Boolean allowRetry) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\FunctionListener.cs:line 69 --- End of inner exception stack trace ---

How should the EventHub Trigger being used om a working environment on Azure?

pascalnaber commented 4 years ago

This solved my issue: github.com/Azure/azure-functions-eventhubs-extension/issues/44