Cloud functions with firebase: firebase.functions is not a function

时间:2018-03-25 20:45:46

标签: node.js firebase google-cloud-functions

After creating a cloud function addMessage on Firebase using Firebase SDK 4.12.0, the following code does not work when attempting to call the addMessage function from within my client app:

var firebase = require("../node_modules/firebase")
var functions = firebase.functions();

functions.httpsCallable("addMessage").call(
    //...
)

TypeError: firebase.functions is not a function

1 个答案:

答案 0 :(得分:4)

The solution was to add require("firebase/functions")