Skip to content

Commit a43730c

Browse files
committed
fix: PublisherClient required credentials even when using the emulator
Fixes #5973
1 parent 4cadc6c commit a43730c

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

‎apis/Google.Cloud.PubSub.V1/Google.Cloud.PubSub.V1/PublisherClient.cs

+1-14
Original file line numberDiff line numberDiff line change
@@ -251,21 +251,8 @@ private static async Task<PublisherClient> CreateMaybeAsync(TopicName topicName,
251251
// Clone settings, just in case user modifies them and an await happens in this method
252252
settings = settings?.Clone() ?? new Settings();
253253
var clientCount = clientCreationSettings?.ClientCount ?? Environment.ProcessorCount;
254-
var channelCredentials = clientCreationSettings?.Credentials;
255-
// Use default credentials if none given.
256-
if (channelCredentials == null)
257-
{
258-
var credentials = isAsync ?
259-
(await GoogleCredential.GetApplicationDefaultAsync().ConfigureAwait(false)) :
260-
GoogleCredential.GetApplicationDefault();
261-
if (credentials.IsCreateScopedRequired)
262-
{
263-
credentials = credentials.CreateScoped(PublisherServiceApiClient.DefaultScopes);
264-
}
265-
channelCredentials = credentials.ToChannelCredentials();
266-
}
254+
267255
// Create the channels and clients, and register shutdown functions for each channel
268-
var endpoint = clientCreationSettings?.ServiceEndpoint ?? PublisherServiceApiClient.DefaultEndpoint;
269256
var clients = new PublisherServiceApiClient[clientCount];
270257
var shutdowns = new Func<Task>[clientCount];
271258
for (int i = 0; i < clientCount; i++)

0 commit comments

Comments
 (0)
X