How to gracefully handle "operations form field could not be decoded #1804
Replies: 5 comments
-
I encountered the same problem... |
Beta Was this translation helpful? Give feedback.
-
I am using
|
Beta Was this translation helpful? Give feedback.
-
facing the same issue, any solutions or workaround? |
Beta Was this translation helpful? Give feedback.
-
I am not sure of this, but one thing I have noticed, while making use of this feature, you can upload an attachment, only if the total length of your query is less that a certain size. We ended up ditching the upload thing, because we felt, since it was not a part of spec of the original graphql and given the nature of the problem, we used normal file upload. And that would return an id which would be sent as a part of the graphql mutation. |
Beta Was this translation helpful? Give feedback.
-
I still can not figure out the solution to this problem, and @amitavaghosh1's solution may not work in my case, since my operation is a Signup - so a user's profile photo is required and a bunch of other fields. // ...
gqlSrv.AddTransport(transport.POST{})
gqlSrv.AddTransport(transport.MultipartForm{
MaxMemory: 32 * mb,
MaxUploadSize: 50 * mb,
})
//... Request curl --request POST \
--url http://localhost:33200/service \
--header 'Content-Type: multipart/form-data' \
--form 'operations="{\"query\": \"mutation SignupUser($userInfo: SignupUserInput{ signupUser(input: $userInfo) { firstName, lastName } }\",\"variables\": {\"userInfo\": {\"password\": \"tested\",\"profilePhoto\": null,\"firstName\": \"Guy\",\"lastName\": \"Luemba\",\"phoneNumber\": \"+254720000000\"}}"' \
--form 'map={ "0": ["variables.userInfo.profilePhoto"] }' \
--form '0=@/Users/whoami/Desktop/Screenshot 2022-07-01 at 17.58.15.png'
|
Beta Was this translation helpful? Give feedback.
-
What happened?
We have a mutation part in schema which looks like
and we try to upload a file like this:
In our case the acessToken is quite long
And we keep getting:
Or the server
What did you expect?
Not this to happen. Is there any limit on the size of the request body? and if yes can we increase it? or is this error generated from something else. I believe it's the size of the body.
Minimal graphql.schema and models to reproduce
versions
gqlgen version
? github.com/99designs/gqlgen v0.13.0go version
? go version go1.15.2 darwin/amd64Beta Was this translation helpful? Give feedback.
All reactions