I use firebase cloud functions for a small project of mine.
I have set up everything like so and it works fine:
cred = credentials.Certificate("db_key.json")
app = initialize_app(cred)
db = firebase.client(app)
However nowhere in the docs have I found a way to change the db to write to (Other than default).
Any help on how I can set the databaseId in python and deploy the cloud functions?
I have set:
db._database = 'testing-db'
This does work, however I think there’s a reason why _database is private and it’s probably not good practice.
I have also tried to import the firestore db client directly and initialize the Client class myself like so:
import from google.cloud.firestore import Client
db = Client(credentials=cred, database=dbName)
This works locally, however when I try to deploy the cloud functions I get an error:
“error”: “Functions codebase could not be analyzed successfully. It may have a syntax or runtime error”
I’m guessing that this is because Client cannot be imported for some reason but I couldn’t figure out why.
When initializing the firebase client there is also the possibility to provide options. However these only include a database-url which I cannot find in the firebase console.