0

I am learning graphql .I followed this article https://dev.to/dnature/handling-file-uploads-with-apollo-server-2-0-14n7#:~:text=With%20Apollo%20Server%202.0%2C%20you,a%20cloud%20storage%20provider%20instead. for file upload using graphql apollo-server but get endless buffering for response and empty file in images folder.

I am certain error is in following two files

mutation file

schema file

1 Answer 1

3

You need to add graphql-upload package using yarn add graphql-upload. Then you need to do some changes inside ApolloServer creation into the main server file,

const apolloServer = new ApolloServer({
    schema,
    resolvers,
    uploads: false, // add this
  });

then you need to add graphqlUploadExpress middleware from graphql-upload inside your main server file,

  app.use(graphqlUploadExpress({ maxFileSize: 10000000, maxFiles: 10 }));

For more refer to this github issue https://github.com/MichalLytek/type-graphql/issues/37#issuecomment-592467594

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.