简体   繁体   中英

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

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

解决方案是添加require("firebase/functions")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM