Home > other >  Issues running event hub triggered azure function locally, getting "Out of retries creating lea
Issues running event hub triggered azure function locally, getting "Out of retries creating lea

Time:03-07

Currently I have set up the following simple azure azure function which I tested previously few days ago and worked normally but for some unknown reason it returns an error

The function setup is:

    [FunctionName("EventUpdatedHubFunction")]
    public async Task Run([EventHubTrigger(
            "%EventConsumer:Name%",
            ConsumerGroup = "%EventConsumer:ConsumerGroup%",
            Connection = "EventConsumer:ConnectionString")]
        EventData[] events)
    {
        // logic
    }

And the error I am getting when I am running the function is:

[2022-03-04T12:25:32.671Z] The listener for function 'EventUpdatedHubFunction' was unable to start.
[2022-03-04T12:27:09.897Z] The listener for function 'EventUpdatedHubFunction' was unable to start. Microsoft.Azure.EventHubs.Processor: Out of retries creating lease for partition 0. Microsoft.WindowsAzure.Storage: The response ended prematurely, with at least 157 additional bytes expected. System.Net.Http: The response ended prematurely, with at least 157 additional bytes expected.

And this is my config file (which I have no reason to believe is incorrect since it has worked in the past):

{
    "IsEncrypted": false,
        "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "AzureWebJobsDashboard": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet",
        "EventConsumer:Name": "event_consumer_name_test",
        "EventConsumer:ConsumerGroup": "consumer_group_test",
        "EventConsumer:ConnectionString": "Endpoint=.........",
        "Database:ConnectionString": "Server=.;Database=TestDatabase;Trusted_Connection=True;"
    }
}

So far I have attempted to:

  • delete and reinstall the Azure storage emulator on my machine,
  • delete and recreate the azure emulator database,
  • run the azure function solution on an another machine (in which case it actually worked).

So at this point I am out of ideas of what might be causing the problem.

CodePudding user response:

The solution was: through the Azure Storage Explorer, under the Local & Attached find (Emulator - Default Ports)/Blob Containers/azure-webjobs-eventhub container and delete everything in it to free space.

  • Related