简体   繁体   English

在Graphql中上传时限制文件大小

[英]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当我上传大于 30mb 的文件时,我收到错误消息

"413 payload too large". “413 有效载荷太大”。

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 或类似的东西

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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