Azure Logic App: Continuation token is not supported for queries with GROUP BY

Viewed 624

I am trying to use Group By clauses in Azure Logic Apps for querying a single partition which has 1.5m documents.

I can run the query that is coded in the Logic App in the Cosmos Data Explorer without issue:

[{
    "AreasProcessed": 1,
    "TotalProperties": 1286,
    "status": 500
},
{
    "AreasProcessed": 45,
    "TotalProperties": 0,
    "status": 400
},
{
    "AreasProcessed": 2275,
    "TotalProperties": 2399469,
    "status": 200
}]

However, when I run the query in the Logic App, I get the following error:

Continuation token is not supported for queries with GROUP BY. Do not use FeedResponse.ResponseContinuation or remove the GROUP BY from the query.

I have enabled Pagination and Asynchronous Pattern on the Logic App.

The full error on the logic app is below, can anyone help me please?

{"error": {
    "code": 500,
    "source": "logic-apis-westeurope.azure-apim.net",
    "clientRequestId": "4d6a4cdb-8969-4dd7-b382-90929c7ec829",
    "message": "BadGateway",
    "innerError": {
        "status": 500,
        "message": "Continuation token is not supported for queries with GROUP BY. Do not use FeedResponse.ResponseContinuation or remove the GROUP BY from the query.\r\nclientRequestId: 4d6a4cdb-8969-4dd7-b382-90929c7ec829",
        "error": {
            "message": "Continuation token is not supported for queries with GROUP BY. Do not use FeedResponse.ResponseContinuation or remove the GROUP BY from the query."
        },
        "source": "documentdb-we.azconn-we.p.azurewebsites.net"
    }
}}
1 Answers

As far as I know, azure team has integrated "Document Explorer", "Query Explorer", "Script Explorer" features as part of "Data Explorer". So "Data Explorer" is the best way to do the query. I'm not sure azure logic app uses the same backend with "Query Explorer" or "Document Explorer", but it seems the logic app doesn't use the same backend with "Data Explorer". I think it is the reason why you can run the query in "Data Explorer" on portal but can not run the query in logic app.

For this problem, you can create a azure function and do the query with code in the function. Then call the function in your logic app. Here is another post which is similar to your problem(but not same) for your reference.

Related