The 'from' property value in the 'query' action inputs is of type 'Object'. The value must be an array

{tocify} $title={Table of Contents}


Scenario

In a logic app where I have to read the blob files having specific suffix in name from the list of blobs, I used Filter Array from Data operations.

Input to it is the output of Http call (Previous step) which gets the list of blobs and with filter on Name

Filter Array with filter on Name


Filter array is an action in Azure Logic Apps that can be used to filter an array/list/collection of items/records based on a certain condition.

It returns an array of items that meet the specified condition. You can use this action to filter an array of objects or an array of strings.

In testing it worked fine except for one scenario - when there was only one record in the list.

The 'from' property value in the 'query' action inputs is of type 'Object'. The value must be an array



Why it happened 

When there was only one blob the http call to get list returned one item/record - so array was not formed, it remained as single JSON object.

single json object as input to filter array


And it is used as the input to Filter array, but Filter array doesn't allow anything other than array. Thus it throwed the error.

"BadRequest.The 'from' property value in the 'query' action inputs is of type 'Object'. The value must be an array. "



What to do

Having a single blob file is a valid scenario, and also the complain by Filter Array action is also valid - so how to solve it.

We take help of array function, which helps in converting the input into an array

using array function in Filter array expression

Thus the input which is already an array will remain so, and if single object is received then it is converted to array.




Post a Comment

If you have any suggestions or questions or want to share something then please drop a comment

Previous Post Next Post