azure-functions-host icon indicating copy to clipboard operation
azure-functions-host copied to clipboard

Getting Microsoft.Azure.WebJobs.Extensions.Storage: Unable to convert trigger to IStorageQueueMessage.

Open rshubham opened this issue 2 years ago • 3 comments

Is your question related to a specific version? If so, please specify:

Using Azure Functions Core Tools - 4.0.3971.

What language does your question apply to? (e.g. C#, JavaScript, Java, All)

Java

Question

I'm trying to use @QueueTrigger for testing my Azure Function locally, but while triggering it from

http://localhost:8080/admin/functions/my-queue-trigger

I'm getting this error:

[2022-07-31T15:39:45.203Z] System.Private.CoreLib: Exception while executing function: Functions.my-queue-trigger. Microsoft.Azure.WebJobs.Host: Exception binding parameter 'request'. Microsoft.Azure.WebJobs.Extensions.Storage: Unable to convert trigger to IStorageQueueMessage.

Code:

@FunctionName("my-queue-trigger")
    public void run(
            @QueueTrigger(
                    name = "request",
                    queueName = "my-queue",
                    connection = "storage-conn-string"
            ) String request,
            final ExecutionContext context) {
        // logic
    }

I'm setting storage-conn-string in local.settings.json file as well. Could you please help where I'm going wrong?

rshubham avatar Jul 31 '22 15:07 rshubham

I was facing a similar issue, for me I used some JSON in my POST other than

{
    "input": <your data here>
}

I was using this

{
    "test": "test"
}

which raised the error. Maybe this is of any help to you.

jo2 avatar Aug 05 '22 09:08 jo2

@jo2 I used request json as

{}

This worked for timer-trigger but not for queue trigger.

rshubham avatar Aug 07 '22 06:08 rshubham

That might be the problem. queue trigger expects input as the message received. It may be anything but the value has to be present in JSON.

jo2 avatar Aug 07 '22 19:08 jo2

Hi @rshubham Thanks for the feedback, we will investigate this further and let you know about the findings soon

Ved2806 avatar Aug 16 '22 08:08 Ved2806

Hi @rshubham Please try using following JSON.
{ "name" : "request", "queueName" : "my-queue", "connection" : "storage-conn-string" } Please let us know if it helps. Thanks.

Ved2806 avatar Aug 16 '22 10:08 Ved2806

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

ghost avatar Aug 20 '22 13:08 ghost