Closed pgridharan closed 4 days ago
Thank you for the question. I am going to find someone with more Python knowledge to answer.
Is there any update?
Unfortunately, the admin client is fully auto-generated, and does not support connecting to the emulator using just the FIRESTORE_EMULATOR_HOST
env var.
You can still connect to the emulator, but you need to do a but more work to configure the grpc channel yourself. It should look something like this:
from google.auth.credentials import AnonymousCredentials
from google.cloud.firestore_admin_v1.services.firestore_admin.transports.grpc import FirestoreAdminGrpcTransport
from google.cloud.firestore_admin_v1.services.firestore_admin import FirestoreAdminClient
import grpc
FIRESTORE_EMULATOR_HOST="0.0.0.0:8080"
credentials = AnonymousCredentials()
options = [("Authorization", f"Bearer owner")]
channel = grpc.insecure_channel(FIRESTORE_EMULATOR_HOST, options=options)
transport = FirestoreAdminGrpcTransport(host=FIRESTORE_EMULATOR_HOST, channel=channel, credentials=credentials)
admin_client = FirestoreAdminClient(transport=transport)
Hi,
I'm not sure if this is a bug or not a feature, but using the
FirestoreAdminClient
with the emulator does not work 😅Environment details
Python 3.11.9
pip 24.0 from /usr/local/lib/python3.11/site-packages/pip (python 3.11)
google-cloud-firestore
version:2.17.0
Steps to reproduce
FIRESTORE_EMULATOR_HOST
FirestoreAdminClient
instanceCode example
Stack trace