ardatan / graphql-mesh

🕸️ GraphQL Mesh - The Graph of Everything - Federated architecture for any API service
https://the-guild.dev/graphql/mesh
MIT License
3.21k stars 329 forks source link

grpc handler error: "8 RESOURCE_EXHAUSTED: Received message larger than max (6771289 vs. 4194304)" #7137

Open cristianbriscaru opened 2 weeks ago

cristianbriscaru commented 2 weeks ago

Issue workflow progress

Progress of the issue based on the Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.


Describe the bug

When using grpahql-mesh with the grpc handler when making a request if the grpc response is greater than the default max size there will be an error thrown : "8 RESOURCE_EXHAUSTED: Received message larger than max (6771289 vs. 4194304)".

This is caused by the grpc client default max_receive_message_length : 4194304 : https://github.com/grpc/grpc-node/issues/1093.

The only fix for this issue would be to pass a "grpc.max_receive_message_length" config option to the grpc client but grpahql-mesh doesn't support this.

To Reproduce Steps to reproduce the behavior: To reproduce make a request where the response size is greater than 4194304

Expected behavior

A way to pass config options to the grpc client

sources:
  - name: MyGRPCService
    handler:
      grpc:
        endpoint: 'localhost:50051'
        options:
          'grpc.max_receive_message_length':  10000000

Or a way to pass a custom client to the handler

sources:
  - name: MyGRPCService
    handler:
      grpc:
        client: ./custom-grpc-client.js

Environment:

Additional context

ardatan commented 2 weeks ago

Thanks for creating the issue! PRs are welcome if anyone is interested in implementing this missing option!