Limit file size when upload in Graphql

Viewed 2224

I am having trouble uploading files. When I upload a file larger than 30mb, I get the error message

"413 payload too large".

Until now I still can not solve.

Below is my code.

import { ApolloServer, AuthenticationError } from "apollo-server";
const server = new ApolloServer({
  typeDefs,
  resolvers,
  uploads: {
    maxFileSize: 50000000, // 50 MB
    maxFiles: 30,
    maxFieldSize: 50000000 // 50 MB
  },
  dataSources,
  introspection: !(process.env.ENVIRONMENT == "PRODUCTION"),
  playground: !(process.env.ENVIRONMENT == "PRODUCTION")
});

server.listen().then(({ url, subscriptionsUrl }) => {
  console.log(`Server ready at ${url}`);
});

Looking forward to receiving help from everyone.

1 Answers

Guessing the error is from nginx/apache or something similar

Related