diff --git a/provider/grpc/provider.go b/provider/grpc/provider.go index eb21ae8c..db444787 100644 --- a/provider/grpc/provider.go +++ b/provider/grpc/provider.go @@ -259,7 +259,9 @@ func start(ctx context.Context, config provider.Config) (*grpc.ClientConn, io.Re if err != nil { return nil, nil, err } - conn, err := grpc.Dial(fmt.Sprintf("localhost:%v", port), grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.Dial(fmt.Sprintf("localhost:%v", port), + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(provider.MAX_MESSAGE_SIZE)), + grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Fatalf("did not connect: %v", err) } @@ -267,7 +269,9 @@ func start(ctx context.Context, config provider.Config) (*grpc.ClientConn, io.Re } if config.Address != "" { if config.CertPath == "" { - conn, err := grpc.Dial(fmt.Sprintf(config.Address), grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.Dial(fmt.Sprintf(config.Address), + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(provider.MAX_MESSAGE_SIZE)), + grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Fatalf("did not connect: %v", err) } @@ -278,7 +282,9 @@ func start(ctx context.Context, config provider.Config) (*grpc.ClientConn, io.Re return nil, nil, err } if config.JWTToken == "" { - conn, err := grpc.Dial(fmt.Sprintf(config.Address), grpc.WithTransportCredentials(creds)) + conn, err := grpc.Dial(fmt.Sprintf(config.Address), + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(provider.MAX_MESSAGE_SIZE)), + grpc.WithTransportCredentials(creds)) if err != nil { log.Fatalf("did not connect: %v", err) } @@ -288,7 +294,9 @@ func start(ctx context.Context, config provider.Config) (*grpc.ClientConn, io.Re i := &jwtTokeInterceptor{ Token: config.JWTToken, } - conn, err := grpc.Dial(fmt.Sprintf(config.Address), grpc.WithTransportCredentials(creds), grpc.WithUnaryInterceptor(i.unaryInterceptor)) + conn, err := grpc.Dial(fmt.Sprintf(config.Address), + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(provider.MAX_MESSAGE_SIZE)), + grpc.WithTransportCredentials(creds), grpc.WithUnaryInterceptor(i.unaryInterceptor)) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/provider/server.go b/provider/server.go index 82eae0eb..82f9befa 100644 --- a/provider/server.go +++ b/provider/server.go @@ -27,6 +27,7 @@ import ( const ( JWT_SECRET_ENV_VAR = "JWT_SECRET" + MAX_MESSAGE_SIZE = 1024 * 1024 * 8 ) type Server interface { @@ -116,7 +117,7 @@ func (s *server) Start(ctx context.Context) error { gs = grpc.NewServer(grpc.Creds(creds)) } } else if s.CertPath == "" && s.KeyPath == "" { - gs = grpc.NewServer() + gs = grpc.NewServer(grpc.MaxRecvMsgSize(MAX_MESSAGE_SIZE), grpc.MaxSendMsgSize(MAX_MESSAGE_SIZE)) } else { return fmt.Errorf("cert: %v, and key: %v are invalid", s.CertPath, s.KeyPath) }