From 617c3f1b390bd818f2c61bf202c55a1eb43879dd Mon Sep 17 00:00:00 2001 From: Cody Oss Date: Tue, 12 Nov 2024 14:23:24 -0600 Subject: [PATCH] fix(auth): restore use of grpc.Dial There have been a couple of reports lately around some subtle changes in behaviour of using the new recommend method. There is also a known bug, see https://github.com/grpc/grpc-go/issues/7556. Until the bug is fixed and we have a way forward we will revert to calling the deprecated Dial function. Fixes: #7556 --- auth/grpctransport/grpctransport.go | 2 +- auth/grpctransport/pool_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/auth/grpctransport/grpctransport.go b/auth/grpctransport/grpctransport.go index 42d4cbe3062e..38212ed0f82a 100644 --- a/auth/grpctransport/grpctransport.go +++ b/auth/grpctransport/grpctransport.go @@ -322,7 +322,7 @@ func dial(ctx context.Context, secure bool, opts *Options) (*grpc.ClientConn, er grpcOpts = addOpenTelemetryStatsHandler(grpcOpts, opts) grpcOpts = append(grpcOpts, opts.GRPCDialOpts...) - return grpc.NewClient(endpoint, grpcOpts...) + return grpc.Dial(endpoint, grpcOpts...) } // grpcKeyProvider satisfies https://pkg.go.dev/google.golang.org/grpc/credentials#PerRPCCredentials. diff --git a/auth/grpctransport/pool_test.go b/auth/grpctransport/pool_test.go index c6a7f4aeddbc..e8df24f194f2 100644 --- a/auth/grpctransport/pool_test.go +++ b/auth/grpctransport/pool_test.go @@ -68,7 +68,7 @@ func TestClose(t *testing.T) { pool := &roundRobinConnPool{} for i := 0; i < 4; i++ { - conn, err := grpc.NewClient(l.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.Dial(l.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatal(err) }