web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

D365: Service Bus Triggered Function Error: Cannot bind parameter 'parameterName' to type MessageReceiver. Make sure the parameter Type is supported by the binding

AjitPatra Profile Picture AjitPatra 469

Recently, we were working on Service Bus Triggered Azure Durable Function. After writing the necessary code, we deployed the Durable Function to Azure.
After deploying, while trying to test the function, we faced one weird issue saying “Error: Microsoft.Azure.WebJobs.Host: Error indexing method ‘AzureFunctionName’. Microsoft.Azure.WebJobs.Host: Cannot bind parameter ‘parameterName’ to type MessageReceiver. Make sure the parameter Type is supported by the binding. If you’re using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you’ve called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.)”.

Below is the code we were using:

 [FunctionName("UpdateGlobalRatesOnRSLs")]
        public static async Task Run([ServiceBusTrigger("%QueueName%", Connection = "AzureWebJobsServiceBus")] Message message, MessageReceiver receiver, string lockToken, [OrchestrationClient]DurableOrchestrationClient starter, ILogger log)
        {
            string inputMessage = Encoding.UTF8.GetString(message.Body);
}

After spending some time on this issue, we figured out that there was nothing wrong except the name of the parameter of type MessageReceiver. As shown above we were using receiver which was throwing error.

It accepts only messageReceiver as the name of the parameter of type MessageReceiver. So, using it as the name of the parameter as shown below fixed the issue.

 [FunctionName("UpdateGlobalRatesOnRSLs")]
        public static async Task Run([ServiceBusTrigger("%QueueName%", Connection = "AzureWebJobsServiceBus")] Message message, MessageReceiver messageReceiver, string lockToken, [OrchestrationClient]DurableOrchestrationClient starter, ILogger log)
        {
            string inputMessage = Encoding.UTF8.GetString(message.Body);
}

Hope it helps !!


This was originally posted here.

Comments

*This post is locked for comments