Closed victorpowah closed 4 years ago
Try running npm ls graphql-upload
to make sure your using the latest version, maybe the version installed predates the createReadStream
API.
The version im using is the latest one.
-- graphql-upload@10.0.0
If there is only one version installed, and it's the latest, then perhaps upload
being passed into your uploadFeedImages
function is something unexpected - not an upload. Debugging your project is not something I can really help with, sorry.
That´s what i get on the upload attribute
{ pictures: [ Upload { resolve: [Function], reject: [Function], promise: [Promise], file: [Object] }, Upload { resolve: [Function], reject: [Function], promise: [Promise] } ] }
It still cant parse it and its not a problem about the project, this is what express-graphql attach to the upload variable.
Maybe you are not using the Upload
scalar in your schema.
Is there any problem using the buildSchema function of express-graphql?
The mutation is:
uploadFeedImages(
pictures: [Upload!]!
): [Image]
And yes, we have the scalar Upload in the schema.
Probably the Upload
scalar isn't implemented using GraphQLUpload
.
I highly recommend using JS to create a schema, instead of having a seperate SDL string and resolvers you then have to try to bring together.
This is an old, but relevant Stack Overflow question: https://stackoverflow.com/questions/47824603/graphql-custom-scalar-definition-without-graphql-tools
The upload
argument according to your post is of the following shape:
type YourUploadArg = {
pictures: Upload[]
}
I think you mean to iterate through the uploads in the pictures
property...
Similar to mine: https://github.com/jaydenseric/graphql-upload/issues/276
Hi, I have followed the steps to upload multiple files but somehow express-graphql can´t read the files one after the other. I am uploading the files following the [standard].(https://github.com/jaydenseric/graphql-multipart-request-spec)
The code I have is the next one:
The error I get is: createReadStream is not a function.