[Error] The listener for function 'Functions.IoTHub_EventHub1' was unable to start

Faisal 1 Reputation point
2020-08-04T02:23:37.673+00:00

Please help!!!

I have created a function to save the messages from the IoT Hub in a cosmosDB but I run in that error:

2020-08-04T02:15:41.884 [Error] The listener for function 'Functions.IoTHub_EventHub1' was unable to start.Microsoft.Azure.WebJobs.Host.Listeners.FunctionListenerException : The listener for function 'Functions.IoTHub_EventHub1' was unable to start. ---> Microsoft.Azure.EventHubs.Processor.EventProcessorConfigurationException : Encountered error while fetching the list of EventHub PartitionIds ---> Microsoft.Azure.EventHubs.EventHubsException : InvalidSignature: The token has an invalid signature.at async Microsoft.Azure.EventHubs.Amqp.Management.AmqpServiceClient.GetRuntimeInformationAsync()at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.EventHubs.Amqp.AmqpEventHubClient.OnGetRuntimeInformationAsync()at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.EventHubs.EventHubClient.GetRuntimeInformationAsync()at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.EventHubs.Processor.PartitionManager.GetPartitionIdsAsync()End of inner exceptionat async Microsoft.Azure.EventHubs.Processor.PartitionManager.GetPartitionIdsAsync()at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.EventHubs.Processor.PartitionManager.GetPartitionIdsAsync()at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.EventHubs.Processor.PartitionManager.InitializeStoresAsync()at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.EventHubs.Processor.PartitionManager.StartAsync()at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.EventHubs.Processor.EventProcessorHost.RegisterEventProcessorFactoryAsync(??)at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.WebJobs.EventHubs.EventHubListener.StartAsync(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Extensions.EventHubs\Listeners\EventHubListener.cs : 46at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.WebJobs.Host.Listeners.FunctionListener.StartAsync(??) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\FunctionListener.cs : 68End of inner exception

This is the function.json:
{
"bindings": [
{
"name": "IoTHubMessages",
"connection": "airguard-iothub_events_IOTHUB2",
"eventHubName": "airguard-iothub",
"consumerGroup": "$Default",
"cardinality": "many",
"direction": "in",
"type": "eventHubTrigger"
},
{
"name": "outputDocument",
"direction": "out",
"type": "cosmosDB",
"databaseName": "outDatabase",
"collectionName": "MyCollection",
"createIfNotExists": true,
"connectionStringSetting": "enosecosmos_DOCUMENTDB"
}
]
}

and the host.json:

{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
}
}

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,571 questions
Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
591 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Krish G 2,331 Reputation points
    2020-08-05T11:02:45.82+00:00

    Hello @Faisal , while I am not sure whether you are getting this error during local debugging or in deployed environment, but looking at the stack trace, it clearly indicates that the connection string of the IoTHub EventHub compatible endpoint in your configuration is not set correctly.

    Microsoft.Azure.EventHubs.Processor.EventProcessorConfigurationException : Encountered error while fetching the list of EventHub PartitionIds ---> Microsoft.Azure.EventHubs.EventHubsException : InvalidSignature: The token has an invalid signature.

    Please check the <key> part of your connection string: Endpoint=sb://<some name>.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=<key>

    1 person found this answer helpful.