skip to Main Content

I just upgraded my Azure Functions to v4. I have a Service Bus Queue trigger to process the messages of a queue.
After I did the upgrade it is no more fired and I don’t understand why and how to investigate.
The code is not changed from one version to another and I could not find any breaking change on this topic.
The log of the function does not show any error or execution and the messages are stuck in the queue without additional information.

This is my trigger:

public class IncomingQueueTrigger
{
    private string _body;
    private HttpResponseMessage response;
    private SignalErrorQueueItem _errorObj;
    private readonly short _maxTriesCount = 2;
    private readonly HttpClient _client;

    public IncomingQueueTrigger(IHttpClientFactory httpClientFactory)
    {
        _client = httpClientFactory.CreateClient();
    }

    [FunctionName("IncomingQueueTrigger")]
    public async Task Run([ServiceBusTrigger("%my_queue_name%", Connection = "my_connection_string")] ServiceBusReceivedMessage myQueueItem, string label, ServiceBusReceiver messageReceiver)
    {
        // my code
    }
}

2

Answers


  1. Chosen as BEST ANSWER

    Executing locally the Function I got this error: Microsoft.Azure.WebJobs.Host: Error indexing method 'IncomingQueueTrigger'. Microsoft.Azure.WebJobs.Host: Can't bind parameter 'messageReceiver' to type 'Azure.Messaging.ServiceBus.ServiceBusReceiver'.
    And searching on Google I found this in which I understood that with the function update I have also to update the type of the message receiver:

    ServiceBusReceiver => ServiceBusMessageActions

    Now everything is back to work.

    Thanks to HariKrishnaRajoli-MT for suggesting me to try to run the functions locally.


  2. I will suggest you review the Azure Functions Migration Document from 3.x to 4.x for upgrading the runtime version of your function app.

    Also, information on code changes when migrating the .NET Core 3.1 to 6.0 – document and regarding how to update package references in Azure Functions when runtime version is migrated.

    If it is not working locally, debug the function code and check or if it works locally and not working in the Azure, do the remote debugging and also check this window in the Azure Function App Portal:

    enter image description here

    If the issue still persists, contact the Azure Support through mail ([email protected]) by providing the Issue Description, Result/Error Screenshots and the troubleshooting steps you followed.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search