简体   繁体   中英

Issue in the firestore while running through cloud function

I have implemented my python code as per https://github.com/GoogleCloudPlatform/solutions-gcs-bq-streaming-functions-python/blob/master/functions/streaming/main.py

Just instead of storage trigger, I am using a pubsub trigger through cloud scheduler and loading the files present in a bucket.

But while running the function I am getting below error.

raise valueerror("a document must have an even number of path elements")

I am using firestore version 1.8.1 in requirements file.

Can someone please suggest me what is wrong here?

That error means you're trying to use a Firestore collection as a document. Check that all your Firestore document paths are correct.

# Odd number of path elements means it's a collection, not a doc
doc_ref_error = db.document('collection/document/subcollection')
# Fixed
doc_ref = db.document('collection/document/subcollection/subdocument')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM