Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Azure.WebJobs.Host.Listeners.FunctionListenerException for eventhub triggers

I am using azure webjobs v3 for eventhub trigger. Till sometime everything was working fine. Suddenly I am getting below error. Can someone help me in resolving this?

public async Task Trigger00([EventHubTrigger("%eventhub-00%", Connection = "ConnectionString")] string message)
       {
          blah... 
       }
Host.Startup[0]
      The listener for function 'Trigger00' was unable to start.
Microsoft.Azure.WebJobs.Host.Listeners.FunctionListenerException: The listener for function 'Trigger00' was unable to start. ---> System.MissingMethodException: Method not found: 'Void Microsoft.Azure.EventHubs.EventHubsException..ctor(Boolean, System.String, System.Exception)'.
   at Microsoft.Azure.EventHubs.Processor.EventProcessorConfigurationException..ctor(String message, Exception innerException)
   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) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Extensions.EventHubs\Listeners\EventHubListener.cs:line 46
   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 68
   --- End of inner exception stack trace ---
like image 583
sindhuja Avatar asked Dec 18 '22 15:12

sindhuja


1 Answers

I resolved this by removing my direct dependency on Microsoft.Azure.EventHubs 4.1.0.

Microsoft.Azure.WebJobs.Extensions.EventHubs 3.0.6 depends on an old version of Microsoft.Azure.EventHubs (2.1.0). I have read that there are breaking changes in this package, this might explain the error.

Before:

    <PackageReference Include="Microsoft.ApplicationInsights" Version="2.10.0" />
    <PackageReference Include="Microsoft.Azure.Cosmos" Version="3.1.1" />
    <PackageReference Include="Microsoft.Azure.EventHubs" Version="4.1.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventHubs" Version="3.0.6" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.29" />

After:

    <PackageReference Include="Microsoft.ApplicationInsights" Version="2.10.0" />
    <PackageReference Include="Microsoft.Azure.Cosmos" Version="3.1.1" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventHubs" Version="3.0.6" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.29" />
like image 188
Iain Avatar answered May 04 '23 22:05

Iain