Closed pedropapa closed 2 years ago
The problem is, the map
field of the GraphQL multipart request is supposed to only map what parts of the operation JSON contain the file upload scalar values, but you are also incorrectly using it to map a string value user
. The numbered fields after map
are only meant to contain the files, but in your case the field named 1
incorrectly contains a string user
and is not a file field.
You can include the non file upload GraphQL variables in the operations
field JSON. This might make more sense if you re-read the spec very carefully about what is in each of the multipart request fields:
https://github.com/jaydenseric/graphql-multipart-request-spec#multipart-form-field-structure
I'm using
graphql-upload
with NestJS, everything works fine if I have just one graphql argument in the file upload mutation. In my case I also need to send atype
argument as a String to know in the server-side how I should handle this upload.When I add this new argument in the mutation and send it in to the request I start having this error
Variable \"$type\" got invalid value { resolve: [function], reject: [function], promise: {} }
. I wasn't able to dig intographql-upload
source code to find out what's happening under the hood.If I remove
type
argument from the mutation and from Postman request I get the file uploaded without errors.Repro: https://github.com/pedropapa/github-upload-issue-repro