diff --git a/pkg/common/container_client.go b/pkg/common/container_client.go index 08833e490..a9a181673 100644 --- a/pkg/common/container_client.go +++ b/pkg/common/container_client.go @@ -58,12 +58,13 @@ func (c *ContainerClient) connect() error { } maxMessageSize := 1 << 30 // 1Gi + dialOpts = append(dialOpts, grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(maxMessageSize), + grpc.MaxCallSendMsgSize(maxMessageSize), + )) + if c.ServiceToken != "" { - dialOpts = append(dialOpts, grpc.WithUnaryInterceptor(GRPCClientAuthInterceptor(c.ServiceToken)), - grpc.WithDefaultCallOptions( - grpc.MaxCallRecvMsgSize(maxMessageSize), - grpc.MaxCallSendMsgSize(maxMessageSize), - )) + dialOpts = append(dialOpts, grpc.WithUnaryInterceptor(GRPCClientAuthInterceptor(c.ServiceToken))) } conn, err := grpc.Dial(c.ServiceUrl, dialOpts...) diff --git a/pkg/gateway/gateway.go b/pkg/gateway/gateway.go index a5f63bfcd..2aa5ab2da 100644 --- a/pkg/gateway/gateway.go +++ b/pkg/gateway/gateway.go @@ -264,7 +264,13 @@ func (g *Gateway) initGrpcProxy(grpcAddr string) error { cancel() }) mux := runtime.NewServeMux() - opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} + opts := []grpc.DialOption{ + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(g.Config.GatewayService.GRPC.MaxRecvMsgSize*1024*1024), + grpc.MaxCallSendMsgSize(g.Config.GatewayService.GRPC.MaxSendMsgSize*1024*1024), + ), + } if err := pb.RegisterPodServiceHandlerFromEndpoint(ctx, mux, grpcAddr, opts); err != nil { return err } diff --git a/sdk/src/beta9/channel.py b/sdk/src/beta9/channel.py index 76d0a2c9a..170eab053 100644 --- a/sdk/src/beta9/channel.py +++ b/sdk/src/beta9/channel.py @@ -142,7 +142,10 @@ def handle_grpc_error(error: grpc.RpcError): elif code == grpc.StatusCode.CANCELLED: return elif code == grpc.StatusCode.RESOURCE_EXHAUSTED: - terminal.error("Please ensure your payload or function arguments are less than 4 MiB.") + terminal.error( + f"Message size exceeds the gRPC limit. " + f"Please ensure your payload or function arguments are less than {GRPC_MAX_MESSAGE_SIZE // (1024 * 1024)} MiB." + ) elif code == grpc.StatusCode.UNKNOWN: terminal.error(f"Error {details}") else: