简体   繁体   中英

Limit file size when upload in Graphql

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.

猜测错误来自 nginx/apache 或类似的东西

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM