Yaak Logo
Yaak
Feedback/Graphql incorrect request after import from Curl

Graphql incorrect request after import from Curl

Daniel Breiner·3 months ago
Up NextBug

After importing a request from Curl and changing the type from JSON to GQL, sent requests have an invalid request body: {"query":""}. Making the variables field dirty (changing it in any way) fixes this.

Reproduction:

  1. Copy any GQL request as Curl:
    curl 'https://gui-api-alpha.recombee.net/graphql?o=AccountScreenUpdateCurrentUserMutation' \
      -X POST \
      -H 'content-type: application/json' \
      --data-raw $'{"operationName":"AccountScreenUpdateCurrentUserMutation","query":"mutation AccountScreenUpdateCurrentUserMutation($input: CurrentAdminInput\041) {\\n  updateCurrentAdmin(input: $input) {\\n    id\\n    lastLoginAt\\n    email\\n    fullName\\n    createdAt\\n    ultimateAdminPermissions\\n    picture\\n    role\\n    __typename\\n  }\\n  __typename\\n}","variables":{"input":{"fullName":"Daniel Breiner","role":"ENGINEER"}}}'
    
  2. Import from Curl
  3. Change type from JSON to GraphQL
  4. Click send - the request will fail. You can look at the sent request - it is not valid ({"query":""})
  5. You can work around the issue by changing the variables in any way (add/remove/also copy and paste the same contents works)
macOS2026.2.0; 2026.2.0-beta.11

Comments (2)

Sign in to leave a comment.

Gregory SchierUp Next

Ah thank you for reporting! I’ve had a few people mention empty queries but was never able to reproduce. I think the curl import piece is what I was missing.

Daniel BreinerOP

Hey @gschier, I looked into fixing this and identified the problem and two possible solutions.

When changing the request type to GraphQL, model body doesn’t get changed, only bodyType (to “graphql”). That means the body is still in the old (incorrect) format { text: ... instead of the gql format { query: ..., variables: ... }.

You could fix this by updating the model patch on bodyType change (in HttpRequestPane->tabs->onChange). Or let the GraphQLEditor component handle it for you by sending an onChange on first render (useEffect(() => { onChange(currentBody) }, [])).

Let me know your thoughts and if you’d like me to open a MR.

Type to search feedback...