moleculerjs/moleculer-apollo-server

413 graphql error

cr1979 opened this issue · 3 comments

Hello,
I'm trying to send a base64 coded image file about 500kb and I'm getting a 413 error, because the content is too large. I figured out that there is a option to set a limit but it is not working and will be ignored. Maybe I forgot something or it's a issue? The server is currently running local with node.js

I tried so far:

const ApiService: ServiceSchema = {
name: "api",

mixins: [
// Gateway
ApiGateway,  // m

// GraphQL Apollo Server
ApolloService({
  // Global GraphQL typeDefs
  typeDefs: `
			type UpdateResponse {
				n: Int!
				nModified: Int!
				ok: Int!
			}

			type DeleteResponse {
				n: Int!
				ok: Int!
				deletedCount: Int!
			}
		`,

  // Global resolvers
  resolvers: {
    Upload: GraphQLUpload
  },

  schemaDirectives: {
    auth: AuthDirective,
  },

  // API Gateway route options
  routeOptions: {
    path: "/graphql",
    cors: true,
    mappingPolicy: "restrict",
    bodyParsers: {
      json: true,
      urlencoded: { extended: true, limit: '5mb' }
    },
  },

  // https://www.apollographql.com/docs/apollo-server/v2/api/apollo-server.html
  serverOptions: {
    tracing: __DEV__,
    playground: __DEV__,
    introspection: __DEV__,
    uploads: {
      maxFieldSize: 5000000,
      maxFileSize: 5000000,
      maxFiles: 100
    },

   // ...

used versions:
"moleculer-apollo-server": "^0.3.0",
"moleculer-web": "^0.9.1",

If more information is needed, please let me know.
Thanks

@cr1979 Were you ever able to get past this? If you are still having an issue, can you produce a working example to be tested?

@shawnmcknight it's a while ago and I got it fixed. The problem was not the server, the problem was the apollo client. Thanks for asking 👍

@cr1979 glad you were able to get it fixed!