Skip to content
Advertisement

httpsCallable is not a function when calling a Firebase function

I’m trying to implement a role-based authentication using Firebase auth and Firebase functions. Right now I have a registration form that is working as supposed and now I’m trying to add a form that you submit an email that calls the Firebase function that will attach a custom claim to a user. I already added my function to Firebase via the terminal and I’m calling functions on my project but whenever I submit the form with the email I get a httpsCallable is not a function error.

Here are my files:

index.js inside functions folder

JavaScript

My firebaseInit.js config file where I call everything firebase related

JavaScript

And my Vue component where the form is

JavaScript

Can someone shed a light on why I’m getting this error? Am I forgetting to import something firebase related?

Advertisement

Answer

Your problem comes from the fact that by doing

JavaScript

in your firebaseInit.js file, you aren’t exporting fc (nor fv by the way)

The following should work

JavaScript

Then, in your component you do:

JavaScript

Or the following it you only need fc and db, for example:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement