Microsoft.Azure.WebJobs.Host: Error indexing method ‘HubFunction.Run’. Microsoft.Azure.WebJobs.ServiceBus: Value cannot be null.

Got the following errors when trying out Azure’s Event Hub trigger for Azure Functions

Warning: Cannot find value named 'Endpoint=sb://DDDD' in local.settings.json that matches 'connection' property set on 'eventHubTrigger' in 
You can run 'func azure functionapp fetch-app-settings <functionAppName>' or specify a connection string in local.settings.json.

original code:
public static void Run([EventHubTrigger(“ais-hub”, Connection = “Endpoint=sb://MY-ENDPOINT…”)]string myEventHubMessage, TraceWriter log)

Connection string–primary key needs to be in `local.settings.json`

“EventHubConnection”: “Endpoint=sb://MY-ENDPOINT…AND OTHER DETAILS”

and then in code referenced as

 public static void Run([EventHubTrigger("hub1", Connection = "EventHubConnection")]string myEventHubMessage, TraceWriter log)


Next Problem

After this was solved the next problem that will likely popup is:

The listener for function was unable to start. Microsoft.ServiceBus: The messaging entity ‘Management operation failed. status-code: 404, status-description: The messaging entity sb://<private> could not be found..’ could not be found. EventHubTrigger “eventHubName”

The problem was due to me not realizing that was I’ve created with the Azure portal was a hub namespace (and not the hub with a certain name); that needs to be done within the namespace; e.g.:





About Neil Rubens

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *