I've been struggling to define table/blob output bindings based on data in a queue trigger. I realize I could accomplish this with imperative binding in code, but I think this should also be possible via the bindings in functions.json. I thought I'd solved this, but am now getting a strange runtime error which I cannot find any information on via searching.
Here's the functions.json definition I am using:
{
"bindings": [
{
"name": "myQueueItem",
"type": "queueTrigger",
"direction": "in",
"queueName": "w2pdfqueue",
"connection": "xxxxxxxx"
},
{
"type": "table",
"name": "FW2Table",
"tableName": "FW2",
"take": 1,
"connection": "xxxxxxxxx",
"direction": "in",
"partitionKey": "{PartitionKey}",
"rowKey": "{RowKey}"
},
{
"type": "blob",
"name": "outputBlob",
"path": "{ClientID}/{ResourceID}",
"connection": "xxxxxxxxxx",
"direction": "inout"
}
],
"disabled": false
}
And here is the Run statement I have:
public static void Run(W2QueueItem myQueueItem, TraceWriter log, W2Row FW2Table, CloudBlockBlob outputBlob)
Finally, the custom queue message I am trying to use for binding:
public class W2QueueItem
{
public string PartitionKey { get; set; }
public string RowKey { get; set; }
public string ClientID { get; set; }
public string ResourceID { get; set; }
}
All of the above compiles successfully, however at runtime I am getting the following error message. I'm not sure how to proceed -- other examples online of binding to custom queue messages do not seem to encounter this type of error. Any suggestions would be welcome!
ost: Binding parameters to complex objects (such as 'W2QueueItem') uses Json.NET serialization.
1. Bind the parameter type as 'string' instead of 'W2QueueItem' to get the raw values and avoid JSON deserialization, or
2. Change the queue payload to be valid json. The JSON parser failed: Unexpected character encountered while parsing value: s. Path '', line 0, position 0.
.
The contents of the message queue when the error occurs are:
{
"PartitionKey": "d6a2e537-a0a0-4949-a6fd-2e56723cdaf0",
"RowKey": "1|053e3136-048d-417b-94c0-6339d3b9c835",
"ClientID": "ef1de151-9855-54d7-4598-6ee416dc5a51",
"ResourceID": "a33efdd2-45ae-47ee-bc56-55b431468962",
"$AzureWebJobsParentId": "e1337646-5f0f-44e4-86fe-e6a46589a739"
}