Azure Function trigger from Service Bus not fired

Jan 0 Reputation points
2025-08-05T12:15:58.75+00:00

Hi there,

we have an Azure Function App with a trigger from Service Bus. The issue is that all messages end up in the Dead Letter Queue rather than being delivered.

Function App

  • written in JavaScript using v4 Programming Model
  • uses connection string stored in environment variables
  • no errors in App insights
  • no invocations in Function App -> [App] -> Overview -> [function]
// File process-queue.js

app.serviceBusQueue('queueProcessJob', {
  connection: 'SERVICE_BUS_CONNECTION_STRING',
  autoComplete: true,
  queueName: process.env.SERVICE_BUS_QUEUE_NAME,
  handler: async (message, context) => {
    context.info('[Process Job] Message received', message);

    // We are using zod to validate the message
    const parsedMessage = jobMessageSchema.safeParse(typeof message === 'string' ? JSON.parse(message) : message);

    if (!parsedMessage.success) {
      context.error('Service Bus Handler Function received invalid message', JSON.stringify(parsedMessage.error.issues, null, 2));
      throw new Error('Invalid queue job message');
    }

    // We process the job here -> we are not calling CompleteMessageAsync or returning anything
  }
});

  • SERVICE_BUS_CONNECTION_STRING contains connection string in format Endpoint=sb://[resource-name].servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=[key] taken from Service Bus -> Settings -> Shared Access Policies -> RootManageSharedAccessKey.
  • Key has Manage, Send, and Listen claims
  • Queue name is stored in SERVICE_BUS_QUEUE_NAME and the value is correct.

When I invoke the function directly, it processes the data without any error, which leads me to believe that the "processing" is not an issue, but the trigger is not fired at all.

Also there are no exceptions or traces in App Insights, I tried running following queries:

traces | where message contains "queueProcessJob"

and

exceptions

Service Bus

  • created in the same "subscription" plan
  • messages appear in Queue and then are moved to Dead-letter queue with reason MaxDeliveryCountExceeded
  • time to live = 86400000
  • delivery count = 10

Questions

Is there a way to debug the trigger? Why is it not firing and immediately goes to Dead-letter?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
{count} votes

1 answer

Sort by: Most helpful
  1. Jan 0 Reputation points
    2025-08-08T15:34:39.94+00:00

    Hi Rakesh, I think I found a solution. It was not something from your suggestions.

    We were getting traces/exceptions for other functions. Just nothing relevant for this function triggered by Service Bus. Sorry for bad wording in the initial question.

    In the end what helped was adding “function:{functionName}” (where {functionName} is the name of function triggered by Service Bus) to the Scaling configuration of our Consumption plan. This ensures the function never goes to sleep and there is always at least one instance ready.

    Is it possible that the service bus trigger cannot wake up the function?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.