Skip to content

Commit 6a098d9

Browse files
authored
pubsub/gcppubsub: tell gRPC to allow messages up to 10MB (default is 4MB) (#2948)
1 parent cfa5c0f commit 6a098d9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pubsub/gcppubsub/gcppubsub.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,14 @@ func Dial(ctx context.Context, ts gcp.TokenSource) (*grpc.ClientConn, func(), er
238238
conn, err := grpc.DialContext(ctx, endPoint,
239239
grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")),
240240
grpc.WithPerRPCCredentials(oauth.TokenSource{TokenSource: ts}),
241+
// The default message size limit for gRPC is 4MB, while GCP
242+
// PubSub supports messages up to 10MB. Tell gRPC to support up
243+
// to 10MB.
244+
// https://github.com/googleapis/google-cloud-node/issues/1991
245+
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024*1024*10)),
241246
useragent.GRPCDialOption("pubsub"),
242247
)
248+
243249
if err != nil {
244250
return nil, nil, err
245251
}

0 commit comments

Comments
 (0)