Encountered error while fetching the list of EventHub PartitionIds. Microsoft.Azure.Amqp

Viewed 4921

I am getting below error while running Function app.

  • Version: V2 Function App
  • Running from Visual Studio 2017

[1/17/2019 3:29:11 AM] The listener for function 'device-message-funcapp' was unable to start. [1/17/2019 3:29:11 AM] The listener for function 'device-message-funcapp' was unable to start. Microsoft.Azure.EventHubs.Processor: Encountered error while fetching the list of EventHub PartitionIds. Microsoft.Azure.Amqp: An existing connection was forcibly closed by the remote host. [1/17/2019 3:29:14 AM] Host lock lease acquired by i

This is my method

public static class DeviceMessageFunction
{

    [FunctionName("device-message-funcapp")]
    public static void Run([IoTHubTrigger("messages/events", Connection = "EventHub")]EventData message, ILogger log)
    {
        log.LogInformation($"C# IoT Hub trigger function processed a message: {Encoding.UTF8.GetString(message.Body.Array)}");
    }
}

Here is my connection string

{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=lctestfunctionsa;AccountKey=********;BlobEndpoint=https://**********.blob.core.windows.net/;TableEndpoint=https://********.table.core.windows.net/;QueueEndpoint=https://***.queue.core.windows.net/;FileEndpoint=https://***.file.core.windows.net/",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"EventHub": "Endpoint=sb://iothub-******.servicebus.windows.net/;SharedAccessKeyName=iothubowner;SharedAccessKey=***;"}}

I have even tried enable the ports [5672, 9350, 9354, 5671] But no luck.

How do I know which protocol used to connect to event hub and how do I fix it. It works fine in home network

It is not duplicate of In Azure Eventhub reciever giving "Encountered error while fetching the list of EventHub PartitionIds" error

3 Answers

If someone landed here with the following error :

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)'

Make sure you have installed latest version of Microsoft.Azure.EventHubs.Processor

Make sure messages/events is actually the name of your event hub queue instance.

Removing reference to Package Microsoft.Azure.Eventhubs fixed the issue.

Related