You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Avoid Authentication When Connecting to Storage Emulator #324
Problem
When connecting to a 3rd party storage emulator, like gcloud-storage-emulator, authentication is required. This requires injecting credentials into containers and adding conditional logic in code to authenticate when running against emulators.
It's quite annoying that you can't simply initiate the storage client if you ever intend to run tests.
client = storage.Client()
You always have to write some kind of wrapper like this.
if os.getenv("STORAGE_EMULATOR_HOST"):
# Local testing etc.
client = storage.Client.create_anonymous_client()
client.project = "none"
else:
# Normal usage
client = storage.Client()
Problem
When connecting to a 3rd party storage emulator, like
gcloud-storage-emulator, authentication is required. This requires injecting credentials into containers and adding conditional logic in code to authenticate when running against emulators.Solution
When
STORAGE_EMULATOR_HOSTis set, use an insecure connection, as is done forfirestore.