Yaak Logo
Yaak
Feedback/GraphQL requests erroring with "must contain a non-empty `query`"

GraphQL requests erroring with "must contain a non-empty `query`"

Michael Bromley·a year ago
ReleasedBug

When attempting to send a GraphQL query, I am getting the following error:

{
  "errors": [
    {
      "message": "GraphQL operations must contain a non-empty `query` or a `persistedQuery` extension.",
      "extensions": {
        "http": {
          "status": 400,
          "headers": {}
        },
        "code": "BAD_REQUEST"
      }
    }
  ]
}

If I change the request type to JSON, it then works. The issue seems to be intermittent - sometimes changing back to GraphQL then works. Sometimes not.

Windows2025.1.2

Comments (4)

Sign in to leave a comment.

Gregory SchierReleased

The syntax error bug was fixed a while ago but I forgot to close this.

Gregory Schier

Oh this is quite strange. When you say intermittent, does it sometimes start working again after a few tries? Or do you always have to switch the body type to something else?

Also, does it seem like it happens after editing the query or variables? If so, which one?

Gregory Schier

My initial guess from looking at the code is that it might happen when the variables JSON editor has a syntax error.

Edward

I’d say this is correct, as that’s what has just happened to me. I had my variables written without any quotation marks for the keys and as Yaak wasn’t giving me any errors I thought all was good.

Type to search feedback...