Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
Firebase Functions - FirebaseError: Missing required options (force) while running in non-interactive mode

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.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

I've reproduced the error that you have encountered.

error

This error occurs on the latest "firebase-tools": "^10.1.3".

Based on the Delete data with a Callable Cloud Function, the documentation have sample code that still uses "firebase-tools": "9.18.0". You could downgrade your firebase-tools by modifying the package.json. E.g. below:

  "dependencies": {
    "firebase": "^9.6.5",
    "firebase-admin": "^9.12.0",
    "firebase-functions": "^3.16.0",
    "firebase-tools": "9.18.0"
  }

After downgrading, I'm able to delete the specified document successfully. working

You could also use what's @Renaud Tarnec answered by using Admin SDK. E.g. below:

const functions = require("firebase-functions");
const admin = require("firebase-admin");
admin.initializeApp();

db = admin.firestore();

exports.deleteUser = functions.auth.user().onDelete((user) => {
    db.collection("users").doc(user.uid).delete()
      .then(function(user) {
        console.log("Successfully Deleted User:", user.uid)
        })
      .catch((error) => {
        console.log(error);
        throw new functions.https.HttpsError(
            "unknown",
            "Error deleting user's data"
        );
      });
});
over 4 years ago · Santiago Trujillo Report

0

Add force: true to the JSON passed to firebase-tools. Worked for me with version 10.1.4

{
        project: process.env.GCLOUD_PROJECT,
        token: functions.config().fb.token,
        recursive: true,
        yes: true,
        force: true // add this
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!