简体   繁体   English

使用firebase的云功能:firebase.functions不是一个功能

[英]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: 使用Firebase SDK 4.12.0在Firebase上创建云功能addMessage后,尝试从我的客户端应用程序中调用addMessage函数时,以下代码无效:

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

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

TypeError: firebase.functions is not a function TypeError:firebase.functions不是函数

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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