0

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
      }
    }
  }
daver
  • 3
  • 3

1 Answers1

0

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

Jdresc
  • 618
  • 1
  • 5
  • 11
  • Thanks! That was it. Now, for bonus points can anyone tell me why I needed to make this change? I assume the project template has a good reason for setting up a queue trigger. Is it because of packages I installed? – daver Aug 20 '21 at 17:50
  • This answer is mentioned in the question linked to above, but it's not obvious in that context. It wasn't the answer to that Java person's question. Hope this helps others. – daver Aug 20 '21 at 18:04
  • The project template you used is for Storage level queues which are different from the Service Bus ones, so when setting up a new project just select Service Bus Queue Trigger template, just added a screenshot of it to the answer – Jdresc Aug 20 '21 at 18:11
  • @daver: Please be sure to mark Jose's answer as accepted once you have the opportunity since it addressed your original question. That will help other people with a similar question see that this question has been addressed in the future—and will also reward Jose for his contribution. – Jeremy Caney Aug 20 '21 at 20:37