Error: "Cloud Fire Error: functions predeploy error: Command terminated with non-zero exit code 1"
I have a view all users screen in my application. On this screen, I have access to both email and uID. I need to build functionality that I can click a delete user button on the users tile. This should then delete the user from firebase authentication and the users collection in firebase. I seen from other posts that the best way for this would be to create a cloud function which I have tried from firestore documentation. I am getting the below error. The code I am trying is from firestore documentation and is as follows:
getAuth()
.deleteUser(uid)
.then(() => {
console.log('Successfully deleted user');
})
.catch((error) => {
console.log('Error deleting user:', error);
});
Attaching documentation link – https://firebase.google.com/docs/auth/admin/manage-users#node.js_7
Any advice is much appreciated.
2
Answers
Edit upon reading your question again:
This isn’t a direct answer to your question but just a few things to note…
You essentially have 2 options here – deleting the user form the front end or firebase functions – each is slightly different.
Front end – You need to pass the user object into
deleteUser()
not the user’s uid, and vice versa passing in the uid.Firebase function example:
Front end example:
https://firebase.google.com/docs/auth/web/manage-users#delete_a_user
This may happen because:
firebase init functions
you answered no when promptedDo you want to use ESLint to catch probable bugs and enforce style?
and/or you answered no when prompted to install dependencies. If that’s the case reinitialize the environment to get it installed.