I'm getting the error message "Cannot convert input parameter" when trying to use my service bus triggered function, why?

Viewed 1616

Is there a way to create azure function that will expect object of ServiceBusReceivedMessage as parameter? like this:

[Function("Function1")]
public static void Run(
    [ServiceBusTrigger("...", "...", Connection = "...")] ServiceBusReceivedMessage  msg)

I have some extension methods created for this class so it would be useful for me to use this class.

I've notice this tutorial Azure Service Bus bindings for Azure Functions

I'm using .net 5 and I've installed via nuget package Microsoft.Azure.WebJobs.Extensions.ServiceBus with beta-5 version but when I try to receive a message i see this error:

Exception: Microsoft.Azure.Functions.Worker.Diagnostics.Exceptions.FunctionInputConverterException: Error converting 1 input parameters for Function 'Function1': Cannot convert input parameter 'msg' to type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage' from type 'System.String'.

not sure if I miss something or if it's possible at all

1 Answers

Microsoft.Azure.WebJobs.Extensions.ServiceBus version 5 is intended to work with in-process Functions SDK. Your solution seems to use Functions isolated worker SDK, which doesn't support SDK types as of now.

Related