insomnia: GraphQL request are adding field "operationName" which results in a failed call.
Expected Behavior
The query string should not have the field “operationName” added.
Eg. Supplied query string:
{ assetCollection { total } }
should results in:
{"query":" { \n\t assetCollection { total }\n}"}
Actual Behavior
Insomnia adds the field “operationName” to the query string, which causes the request to fail.
Eg. Supplied query string:
{ assetCollection { total } }
results in:
{"query":" { \n\t assetCollection { total }\n}","operationName":"Operations"}
Reproduction Steps
Just create a new GraphQL request. Normally this does not happen. But it some point insomnia will start to add this field. And ones it does it keeps adding it all the time.
I do not see anyway to get it to work again, besides deleting the whole request entry and create it completely from scratch.
Is there an existing issue for this?
- I have searched the issue tracker for this problem.
Additional Information
No response
Insomnia Version
2022.7.4
What operating system are you using?
macOS
Operating System Version
13.0.1
Installation method
download
Last Known Working Insomnia version
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 21 (2 by maintainers)
Same here. Please reopen this issue !
Same. It won’t work. For some reason, newly created requests are not functioning while existing requests are working properly.
Hi folks, this should be fixed on latest 2022.7.5
I’m still getting this issue.
Version: Insomnia 2022.7.5 Build date: 19.01.2023 г. OS: Windows_NT x64 10.0.22621 Electron: 22.0.0 Node: 16.17.1 V8: 10.8.168.20-electron.0 Architecture: x64
Request in Insomnia:
Actual request sent:
{"query":"query {\n\treservations(\n\t\tinput: {\n\t\t\tdriverId: \"dc8ef8b1-5591-43f7-9732-29a03fa45cb6\"\n\t\t}\n\t) {\n\t\tid\n\t}\n}\n","operationName":"Operations"}
+1. Running 2022.7.5, when duplicating a query, I get the extra
"operationName":"Operations"
field in the query being sent to the server, which breaks the server. Creating the query from scratch seems to solve it. Another alternative is to use “Copy to Curl”, modify the generated curl output, and then paste it into a terminal.Creating a new request (NOT duplicating a bugged one) and copying the query/mutation seems to be a workaround
It also worked for me. Thanks!
Would like to summarise… One need to select a blank field from empty dropdown. If not
"operationName":"Operations"
is still being sent. I would still consider this as a bug.I wasted time looking for a problem somewhere else, until I realized that it was Insomnia setting this field to
Operations
.I can’t tell for sure whether this happens only to queries created by duplicating another (although this seems to be the case), but I found a simpler workaround than recreating from scratch or going through curl: Notice the “Operations” label below?
That’s the
operationName
you’ll get. Just click it and you’ll get a dropdown that already includes the correct query name. Select it and you’re done. Now the request will pass this validation on the server side.Edit: Your query has to have a name for the name to be pre-populated, like
query whatever { ... }
. If it doesn’t, then you’ll get an empty list and there’s no way to select anything other than “Operations”. But Insomnia seems to omitoperationName
when you have an anonymous query anyway, so it’s not a problem.