Skip to content

Commit

Permalink
fix(grpc): return error if credentials are detected to be null (#2142)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWhitehead authored Jul 27, 2023
1 parent e0191b5 commit b61a976
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import com.google.cloud.storage.UnifiedOpts.UserProject;
import com.google.cloud.storage.spi.StorageRpcFactory;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.storage.v2.ReadObjectRequest;
Expand Down Expand Up @@ -169,6 +170,7 @@ private Tuple<StorageSettings, Opts<UserProject>> resolveSettingsAndOpts() throw

Opts<UserProject> defaultOpts = Opts.empty();
CredentialsProvider credentialsProvider;
Preconditions.checkState(credentials != null, "Unable to resolve credentials");
if (credentials instanceof NoCredentials) {
credentialsProvider = NoCredentialsProvider.create();
} else {
Expand Down

0 comments on commit b61a976

Please sign in to comment.