Closed
Description
Environment details
Environment: GCF python37 runtime
Version: google-cloud-firestore==1.4.0
Steps to reproduce
- Initialize a fs document:
- Deploy a HTTP triggered GCF that creates a listener, then unsubscribes.
- View logs.
Code example
from google.cloud import firestore
# Initialization code, run prior to deploy.
# fs_client = firestore.Client()
# doc_ref = fs_client.collection("test").document("subtest")
# doc_ref.set({"hello": "world"})
def abort_now_listener(doc_snapshot, changes, read_time):
for doc in doc_snapshot:
doc_vals = doc.to_dict()
print(doc_vals["hello"])
# gcloud functions deploy watch_fs --runtime python37 --trigger-http
def watch_fs(request):
print("creating client")
fs_client = firestore.Client()
doc_ref = fs_client.collection("test").document("subtest")
print(doc_ref)
watcher = doc_ref.on_snapshot(abort_now_listener)
print("after watcher")
watcher.unsubscribe()
print("the end!")
return "hello world"
GCF Logs attached.