Upload value invalid.
Closed this issue · 6 comments
Thanks, Ben for the series, please help I'm getting this error
{
"message": "Variable \"$picture\" got invalid value {};
Expected type Upload. Upload value invalid.",
}
This is how I pass the values on Postman
I've checked the docs over and over
{
"query": "mutation UploadFile($picture: Upload!) {uploadFile(picture: $picture) }",
"variables": {"picture": null}
}
and for the map
field this is what I pass
{
map: ["variables.picture"]
}
and then the file field which is 0
0: uploaded_file
that looks correct, I'm not sure why it doesn't work
you could try curl
https://github.com/jaydenseric/graphql-multipart-request-spec#curl-request-1 or using https://github.com/jaydenseric/apollo-upload-client
Thanks, Ben, I will check it out
having same error. why we use
import { GraphQLUpload } from "graphql-upload" instead of
import { GraphQLUpload } from "apollo-server-express";
i tried to change but @arg("photo", () => GraphQLUpload) line give the following error
No overload matches this call.
Overload 1 of 2, '(name: string, options?: Options | undefined): ParameterDecorator', gave the following error.
Type '() => GraphQLScalarType | undefined' has no properties in common with type 'Options'.
Overload 2 of 2, '(name: string, returnTypeFunc: ReturnTypeFunc, options?: Options | undefined): ParameterDecorator', gave the following error.
Type 'GraphQLScalarType | undefined' is not assignable to type 'ReturnTypeFuncValue'.
Type 'undefined' is not assignable to type 'ReturnTypeFuncValue'.ts(2769)
types.d.ts(10, 38): The expected type comes from the return type of this signature.
Photo.ts(13, 19): Did you mean to mark this function as 'async'?
I think you just want import { GraphQLUpload } from "graphql-upload"
I am experiencing the same issue @benawad . I am sending the file from the client side using https://github.com/jaydenseric/apollo-upload-client as an Upload type. But the Upload type is not being understood by the API. I think it needs to be declared somehow
Sorry, i added graphql-upload as a dependency, meanwhile apollo-server-express already includes version 8. And having both created the confusing error