I have a Firebase Function that deletes a user's collection in a Firestore database when their account is deleted.
const firebase_tools = require("firebase-tools");
const functions = require("firebase-functions");
const admin = require("firebase-admin");
admin.initializeApp();
exports.deleteUser = functions.auth.user().onDelete((user) => {
return firebase_tools.firestore
.delete(`users/${user.uid}`, {
project: process.env.GCLOUD_PROJECT,
token: functions.config().fb.token,
recursive: true,
yes: true
}).catch((error) => {
console.log(error);
throw new functions.https.HttpsError(
"unknown",
"Error deleting user's data"
);
});
});
Whenever a user is deleted and the function is executed, I get the following error in the Functions logs.
FirebaseError: Missing required options (force) while running in non-interactive mode
at prompt (/workspace/node_modules/firebase-tools/lib/prompt.js:16:15)
at promptOnce (/workspace/node_modules/firebase-tools/lib/prompt.js:29:11)
at Command.actionFn (/workspace/node_modules/firebase-tools/lib/commands/firestore-delete.js:69:51)
at Object.delete (/workspace/node_modules/firebase-tools/lib/command.js:190:25)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
The only information I could find related to this is regarding deploying/deleting functions to Firebase and there's not much documentation for firebase-tools that I could find.