2

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://learn.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
        ...
    }
}
2
  • 2
    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 invocations Commented Oct 18, 2017 at 15:53
  • 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. Commented Oct 18, 2017 at 21:06

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I can confirm that this is still an issue when starting a new Azure Functions project using the Visual Studio template, and this answer resolves it. Going through MS docs, somewhere I was instructed to add a Nuget reference to Microsoft.Azure.Storage. However, the existing reference in the project to Microsoft.WindowsAzure.Storage contains slightly different APIs and work just fine for the scenario described in the original post.
In case this helps someone else - I changed from Microsoft.WindowsAzure.Storage.Queue to Microsoft.Azure.Storage.Queue and that did the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.