Skip to content

Commit db92a3a

Browse files
authored
Merge pull request #36415: Add logging for credential retrieval failures in GcpCredentialFactory
2 parents 243d407 + ab892e3 commit db92a3a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/auth

sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/auth/GcpCredentialFactory.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import org.apache.beam.sdk.extensions.gcp.options.GcpOptions;
2929
import org.apache.beam.sdk.options.PipelineOptions;
3030
import org.checkerframework.checker.nullness.qual.Nullable;
31+
import org.slf4j.Logger;
32+
import org.slf4j.LoggerFactory;
3133

3234
/**
3335
* Construct an oauth credential to be used by the SDK and the SDK workers. Returns a GCP
@@ -38,6 +40,8 @@ public class GcpCredentialFactory implements CredentialFactory {
3840
private List<String> oauthScopes;
3941
// If non-null, a list of service account emails to be used as an impersonation chain.
4042
private @Nullable List<String> impersonateServiceAccountChain;
43+
// Logger for logging credentials fails
44+
private static final Logger LOG = LoggerFactory.getLogger(GcpCredentialFactory.class);
4145

4246
private GcpCredentialFactory(
4347
List<String> oauthScopes, @Nullable List<String> impersonateServiceAccountChain) {
@@ -86,6 +90,7 @@ public static GcpCredentialFactory fromOptions(PipelineOptions options) {
8690
} catch (IOException e) {
8791
// Ignore the exception
8892
// Pipelines that only access to public data should be able to run without credentials.
93+
LOG.warn("Failed to get GCP credentials; proceeding with 'null' credentials.", e);
8994
return null;
9095
}
9196
}

0 commit comments

Comments
 (0)