Closed maheraldous closed 3 years ago
I think you need to setup the GraphQLUpload
scalar:
https://github.com/jaydenseric/graphql-upload#class-graphqlupload
Now I am getting this error https://github.com/apollographql/apollo-server/issues/3508
It seems that I have to move back to Node v12 from v14
But is there any way to upload files without going back.
I like the schema-first GraphQL but yours is code-first GraphQL so is there a way to do it with schema-first https://blog.logrocket.com/code-first-vs-schema-first-development-graphql/
You are right it works now thank you very much
In new version, same problem here. Any solutions?
Error:
**TypeError: createReadStream is not a function**
Code:
@Mutation((_) => Boolean)
addProfilePicture(
@Arg("picture", () => GraphQLUpload)
{ createReadStream, filename }: FileUpload
): Promise<boolean> {
return new Promise(async (resolve, reject) =>
createReadStream()
.pipe(createWriteStream(__dirname + `./${filename}`))
.on("finish", () => resolve(true))
.on("error", () => reject(false))
);
}
I find solution when use Fastify/TypeGraphQL
https://github.com/MichalLytek/type-graphql/issues/37#issuecomment-1408637766
@jdgabriel @jaydenseric Hi👋 I have written a related issue here. https://github.com/meabed/graphql-upload-ts/issues/108
i my case order of arguments wasn't coinciding in resolver and service. Make sure that you are passing correctly arguments and handling
Hello
I made a project for a few months ago and everything was working even the upload images but when I started the project again after a while and tried to upload a single image I get this error "createReadStream is not a function"
Is the error there becuase that I updated from Node v12 to v14?