The Guild LogoThe Guild Monogram
GraphQL Mesh

GraphQL Mesh

Query anything, run anywhere.

Contact Us

gRPC / Protobuf#

image

This Handler allows you to load gRPC definition files (.proto).

yarn add @graphql-mesh/grpc

Now, you can use it directly in your Mesh config file:

sources: - name: MyGrpcApi handler: grpc: endpoint: localhost:50051 protoFilePath: grpc/proto/Example.proto

You can check out our example that uses gRPC Handler. Click here to open the example on GitHub

Use Reflection instead of proto files#

If you have configured reflection in your gRPC server, you can use useReflection flag to load the schema from reflection instead of loading proto files.

sources: - name: gRPC Example handler: grpc: endpoint: localhost:50051 useReflection: true

You can check out our example that uses gRPC Handler with reflection. Click here to open the example on GitHub

Custom Metadata for Authorization#

Here you can use metaData field to pass some custom metadata from the context.

sources: - name: MyGrpcApi handler: grpc: endpoint: localhost:50051 protoFilePath: grpc/proto/Example.proto metaData: authorization: "{req.headers.authorization}" someStaticValue: "MyStaticValue"

 


 

Config API Reference#

  • endpoint (type: String, required) - gRPC Endpoint
  • protoFilePath - - gRPC Proto file that contains your protobuf schema One of:
    • object:
      • file (type: String, required)
      • load (type: Object):
        • defaults (type: Boolean)
        • includeDirs (type: Array of String)
    • String
  • descriptorSetFilePath - - Use a binary-encoded or JSON file descriptor set file One of:
    • object:
      • file (type: String, required)
      • load (type: Object):
        • defaults (type: Boolean)
        • includeDirs (type: Array of String)
    • String
  • requestTimeout (type: Int) - Request timeout in milliseconds Default: 200000
  • credentialsSsl (type: Object) - SSL Credentials:
    • rootCA (type: String)
    • certChain (type: String)
    • privateKey (type: String)
  • useHTTPS (type: Boolean) - Use https instead of http for gRPC connection
  • metaData (type: JSON) - MetaData
  • useReflection (type: Boolean) - Use gRPC reflection to automatically gather the connection