I have a Firebase cloud (callable) function which deletes a firestore document and all child entities, including sub-collections. I'm doing this by slightly modifying the function provided my firebase in their docs: https://firebase.google.com/docs/firestore/solutions/delete-collections
The important bit is here:
...
return firebase_tools.firestore
.delete(path, {
project: process.env.GCLOUD_PROJECT,
recursive: true,
yes: true,
token: functions.config().fb.token
})
...
When I call this function from my webpage (after a user has anthenticated), the web client throws an error that the remote function caused an error. In the firebase console, I find this error:
Unhandled error TypeError: Cannot read property 'token' of undefined
This is pointing to the line in the above code snippet: token: functions.config().fb.token
. So .fb
is null.
What is going on here?
Searching the web tells me something about login:ci
at the command line, but although I'm developing this on my laptop, when the app is deployed, there will be no command line. The website will be on firebase hosting. It makes a call to a firebase cloud function. I'm using firebase auth for user authentication (email/password) and storing data in firestore.
Further, I'm already enabled on my command line, since I can do firebase deploy --only functions
just fine. How do I make sure functions.config().fb
doesn't return a null??