azureazureservicebusazure-servicebus-queuesazure-triggersqueuetrigger

Azure queue trigger error using .Net.Sdk.Functions 3.0.13: Error indexing method 'Function1',Storage: No valid combination of account info found


I cannot get a new servicebus queue trigger to run even after reading many posts on this error. I have not added any logic to the solution yet, simply trying to get the generated shell to run correctly. It is built in Core 3.1, using the QueueTrigger template in VS2019. This trigger is in a solution with another Azure Function, but that one it not a Queue Trigger (it's a Kafka topic trigger). I have the queue trigger set as the startup project.

I continue to get these errors in spite of many change attempts to resolve this:

Microsoft.Azure.WebJobs.Host: 
Error indexing method 'Function1'. 
Microsoft.WindowsAzure.Storage: No valid combination of account information found.

I first tried using dev storage ("AzureWebJobsStorage": "UseDevelopmentStorage=true",) then created an actual storage account. Neither worked. I see the storage emulator start when I attempt to run the trigger.

I read this question but am not clear on what I need to do, if anything, related to blob storage: Queue trigger needs blob storage

Installed Packages:

Microsoft.NET.Sdk.Functions (3.0.13)
Azure.Messaging.ServiceBus (7.2.1)
Microsoft.Azure.WebJobs.Exetensions.Storage (3.0.10)  
Microsoft.Azure.WebJobs.Extensions.ServiceBus (4.3.0)

This is the trigger's signature:

public static class Function1
{
    [FunctionName("Function1")]
    public static void Run([QueueTrigger("queueNameHere", Connection = "AzureWebJobsServiceBus")]string myQueueItem, ILogger log) {

This is my local.settings.json file. Note, I removed the "EndpointSuffix=core.windows.net/;" suffix since many posts said this is a fix. It is ok that both of my key values end in "=", correct?

{
  "Values": {
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=XXX;AccountKey=XXX",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "AzureWebJobsDashboard": "UseDevelopmentStorage=true",
    "AzureWebJobsServiceBus": "Endpoint=sb://MySvcBusNamespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=XXX"
  },
  "IsEncrypted": false
}

host.json file:

{
  "version": "2.0"
}

I tried with this in host.json but have removed it:

  "extensions": {
    "serviceBus": {
      "prefetchCount": 100,
      "messageHandlerOptions": {
        "autoComplete": true,
        "maxConcurrentCalls": 32,
        "maxAutoRenewDuration": "00:05:00"
      },
      "sessionHandlerOptions": {
        "autoComplete": false,
        "messageWaitTimeout": "00:00:30",
        "maxAutoRenewDuration": "00:55:00",
        "maxConcurrentSessions": 16
      },
      "batchOptions": {
        "maxMessageCount": 1000,
        "operationTimeout": "00:01:00",
        "autoComplete": true
      }
    }
  }

Solution

  • The problem is that you are using Storage queue trigger binding public static void Run([QueueTrigger("queueNameHere" You need to use the ServiceBusTrigger instead, see example below https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-trigger?tabs=csharp#example

    Also possibly duplicate of Microsoft.WindowsAzure.Storage: No valid combination of account information found - Tried to edit conn string, but did not work

    enter image description here