Closed sagarPakhrin closed 2 years ago
What exactly is your GraphQL server environment; Node.js version, etc.
What exactly is your GraphQL server environment; Node.js version, etc.
Im in node 14, I tried in node 16 as well same issue.
I'm using graphql-upload with nestjs
You didn't fully answer the question.
graphql-api-koa
, express-graphql
, what? What versions of graphql-upload
and fs-capacitor
are installed in your node_modules?As I was writing this comment I see in your edit you mention nestjs, but please provide the other details.
My machine has node v14.19.0
but my code runs in a docker container from node:16 base image.
for graphql server I'm using these:
@nestjs/graphql @nestjs/apollo graphql apollo-server-express
graphql-upload version: ^13.0.0",
Looks like graphql-upload is using fs-capacitor@6.2.0
I also get this when I do npm ls fs-capacitor
+-- apollo-server-express@2.25.3 invalid: "^3.1.2" from node_modules/@nestjs/graphql
| `-- apollo-server-core@2.25.3
| `-- @apollographql/graphql-upload-8-fork@8.1.3
| `-- fs-capacitor@2.0.4
`-- graphql-upload@13.0.0
`-- fs-capacitor@6.2.0
So I guess there are multiple versions of fs-capacitor
Apollo Server v2 ships with an outdated file uploads implementation built in, which conflicts with the modern manual graphql-upload
setup. Instead of disabling the outdated implementation in Apollo Server v2, you're probably better off figuring out how to use Apollo Server v3 with NestJS.
ISSUE
while uploading file with rest, the type of received file is
But with graphql-upload, the received file is in the format
When I try to create a stream from the file.createReadStream() I get the following error
So the file uploaded to gcs/s3 or local file system doesn't get written correctly because it's still a stream and not a buffer it seems like the issue is with fc-capacitor package