question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

valid json results in not a valid JSON error

See original GitHub issue

The following valid JSON results in an Error running query: Invalid query format. The query is not a valid JSON. error.

{
    "collection": "event",
    "aggregate": [
        {
            "$project": {
                "month": {
                    "$date": "$startDate"
                }
            }
        }
    ]
}

What gets posted to the http endpoint?

curl 'http://localhost/api/query_results' -H 'Accept: application/json, text/plain, */*' -H 'Cookie: session=.eJwdjjGLg0AQRv_KMXUKXbxGuObYRBRmxDCJzDYhR8yts24TOc4Y8t-zpHp8xft4Dzhdb8Psobyep3nYwGm8QPmAjx8oQVgK0qMndVF4Uuopuqq7k9kF6RttbTOR_R7RutFpXaDu075Ep00Qxsxxl2OkiHzIhevkNSo9FmTJC7v0u4tUyYIqGXFnRMNna_2IKy4SxaChkLigOcaW9wHXOmvtISP1Eatudf32n-zvPflf8NzA3zzc3v2Qw_MFsLVHzw.DG2bqw.U5SBWIiOFT9VhZJjRuLnST96TnY' -H 'Connection: keep-alive' --data-binary '{"data_source_id":1,"query":"{\n    \"collection\": \"event\",\n    \"aggregate\": [\n        {\n            \"$project\": {\n                \"month\": {\n                    \"$date\": \"$startDate\"\n                }\n            }\n        }\n    ]\n}","max_age":0,"query_id":5}' --compressed

What do the logs say?

worker_1    | [2017-08-10 07:22:38,603: INFO/MainProcess] Task redash.tasks.execute_query[9b0c71ad-d792-40c8-9c85-f749baabdfa8] succeeded in 0.0139267686754s: QueryExecutionError('Invalid query format. The query is not a valid JSON.',)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
kyoshidajpcommented, Dec 10, 2017

@SebC99 What is the value of {{fromDate}} and {{toDate}} parameter?

My query which is using "$match" and "$date" got a correct result.

{
    "collection": "users",
    "aggregate": [
        {
            "$match": {
                "created_at": {
                    "$gte": {
                        "$date": "2017-01-01T15:00:00.000Z"
                    },
                    "$lt": {
                        "$date": "2018-01-01T15:00:00.000Z"
                    }
                }
            }
        }
    ]
}
1reaction
arikfrcommented, Mar 19, 2018

@SebC99 I’m closing this as the new issue you opened (#2362) is clearer and contains the relevant info. Thanks 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

6 Fixes for "the response is not a valid JSON response" Error in
1. Reset the permalinks ... Before you try anything else, you should try resetting your permalinks to resolve the invalid JSON response error....
Read more >
How to Fix “The Response Is Not a Valid JSON ... - iThemes
Top 5 Issues Behind “The response is not a valid JSON response” Error and How to Address Them · Incorrect WordPress Site Address...
Read more >
How to Fix "Updating Failed. The Response is Not a Valid ...
Encountering the "Updating failed. The response is not a valid JSON response." error? In this article, you will learn how to fix it....
Read more >
How to Fix the Invalid JSON Error in WordPress? - Rank Math
In this article, learn how to fix the invalid JSON error - 'Updating failed. The response is not a valid JSON response.' with...
Read more >
How to Fix the Invalid JSON Response Error in WordPress
How to Fix the WordPress Invalid JSON Response Error · Fix your site's permalinks and . · Check your WordPress site URL. ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found