2
votes

I am getting this error from a QueueTrigger function that also needs a CloudQueue binding.

Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException : Error indexing method 'QueueInstancesToImport.Run' ---> System.InvalidOperationException : Can't bind Queue to type 'Microsoft.WindowsAzure.Storage.Queue.CloudQueue'.

According to the docs CloudQueue should be valid.

https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue

Other potential solutions I have found don't match exactly or don't help.

My code

public static class QueueFormInstancesToImport
{
    [FunctionName("QueueFormInstancesToImport")]
    public static async Task Run(
        [QueueTrigger("import-queue")]string message,
        [Queue("import-queue")]CloudQueue queue,
        TraceWriter traceWriter,
        ExecutionContext context)
    {
        // Body of function
        ...
    }
}
1
Not directly related to your issue but do you really intend to have the trigger and output be against the same Queue? That'll create an infinite loop of function invocationsJesse Carter
Your code should work just fine. I smell some NuGet conflicts. Please check that the only package that you explicitly reference is Microsoft.NET.Sdk.Functions.Mikhail Shilkov

1 Answers

4
votes

This is very likely a nuget package conflict. The assembly version that your 'CloudQueue' parameter is coming from is a different version of the stroage library than what's being used by the underlying Function runtime. You can F12 on the CloudQueue definition to see the full assembly version that it's binding against.

You very likely have add an extra reference to the Azure Storage SDK. Remove the extra reference and just use the reference from the Azure Functions template.