From 931c403805221ead25ba1f90d1a91cbb00b0939f Mon Sep 17 00:00:00 2001 From: Tanner Stirrat Date: Wed, 28 Aug 2024 13:06:59 -0600 Subject: [PATCH] Up max message size --- internal/client/client.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/internal/client/client.go b/internal/client/client.go index b2b7ce53..f7cc351a 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -30,6 +30,17 @@ type Client interface { // NewClient defines an (overridable) means of creating a new client. var NewClient = newGRPCClient +const oneGb = 1 * 1024 * 1024 * 1024 + +var defaultCallOptions = grpc.WithDefaultCallOptions( + // The default max client message size is 4mb. + // It's conceivable that a sufficiently complex + // schema will easily surpass this, so we set the + // limit higher here. + grpc.MaxCallRecvMsgSize(oneGb), + grpc.MaxCallSendMsgSize(oneGb), +) + func newGRPCClient(cmd *cobra.Command) (Client, error) { configStore, secretStore := DefaultStorage() token, err := storage.DefaultToken( @@ -43,11 +54,15 @@ func newGRPCClient(cmd *cobra.Command) (Client, error) { } log.Trace().Interface("token", token).Send() - dialOpts, err := DialOptsFromFlags(cmd, token) + flagDialOpts, err := DialOptsFromFlags(cmd, token) if err != nil { return nil, err } + // NOTE: this works as long as we don't have CallOptions + // defined in flags. We'll have to modify this logic then. + dialOpts := append(flagDialOpts, defaultCallOptions) + client, err := authzed.NewClientWithExperimentalAPIs(token.Endpoint, dialOpts...) if err != nil { return nil, err