Skip to content

Commit ac6f914

Browse files
Passing AnonymousCredentials()
1 parent 49c12f7 commit ac6f914

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

metaflow/plugins/gcp/gs_storage_client_factory.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@ def _get_gs_storage_client_default():
1414
from google.cloud import storage
1515

1616
if os.environ.get("STORAGE_EMULATOR_HOST"):
17-
# Emulator mode: anonymous client, no real GCP credentials needed.
18-
# google-cloud-storage routes requests to STORAGE_EMULATOR_HOST automatically.
19-
_client_cache[cache_key] = storage.Client()
17+
# Emulator mode: supply AnonymousCredentials explicitly so
18+
# google-cloud-storage never calls google.auth.default(), which
19+
# raises DefaultCredentialsError in CI environments with no ADC.
20+
from google.auth.credentials import AnonymousCredentials
21+
22+
_client_cache[cache_key] = storage.Client(
23+
credentials=AnonymousCredentials(), project="test"
24+
)
2025
else:
2126
import google.auth
2227

0 commit comments

Comments
 (0)