Problem with firebase admin database collections method in python

308 views
Skip to first unread message

Juan Antonio Fernández Sánchez

unread,
Jun 19, 2019, 11:23:17 AM6/19/19
to Firebase Google Group

I used to use this code to get a copy of Firestore database to local, but the last day I find this error suddenly:


google.api_core.exceptions.InvalidArgument: 400 Document parent name "projects/some-niceproject/databases/(default)" lacks "/" at index 43.

This is a summary of it:


grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with: status = StatusCode.INVALID_ARGUMENT details = "Document parent name "projects/some-niceproject/databases/(default)" lacks "/" at index 43." debug_error_string = "{"created":"@1560895696.899080325","description":"Error received from peer ipv4:172.217.17.10:443","file":"src/core/lib/surface/call.cc","file_line":1046,"grpc_message":"Document parent name "projects/some-niceproject/databases/(default)" lacks "/" at index 43.","grpc_status":3}"


So, my normal way to proceed is, initialize the app, and instanciate the firestore client :


default_app = firebase_admin.initialize_app( credential=cred )
firestore_db
= firestore.client()


No problem for now, isn't the first time that I do that, but when I do list(collections) the problem appear.

As I think that the problem is that only lack '/' at the end of database path I have been trying to set it, some like this:


print(firestore_db._rpc_metadata_internal)
[('google-cloud-resource-prefix', 'projects/some-niceproject/databases/(default)')]
firestore_db
._rpc_metadata_internal = [('google-cloud-resource-prefix', 'projects/some-niceproject/databases/(default)/')]
print(firestore_db._rpc_metadata_internal)
[('google-cloud-resource-prefix', 'projects/some-niceproject/databases/(default)')]


But without results.


The worst part is that if I set the name of some collection I can access to the documents without problem.

I have tried to downgrade grpcio to older versions (now in 1.21.1) and the same with firebase_admin, without any results.

I can continue the work telling exactly the name of each collection but I would like it not will be necessary because I am working in a package to do more easy the copy of firebase databases.

Any idea about the reason of this new error? Thank you so much!

This question is also in StackOverflow here.

Reply all
Reply to author
Forward
0 new messages