带有 firebase 的云函数:firebase.functions 不是函数 [英] Cloud functions with firebase: firebase.functions is not a function

查看:21
本文介绍了带有 firebase 的云函数:firebase.functions 不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Firebase SDK 4.12.0 在 Firebase 上创建云函数 addMessage 后,尝试从我的客户端应用程序中调用 addMessage 函数时,以下代码不起作用:

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 不是函数

推荐答案

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

这篇关于带有 firebase 的云函数:firebase.functions 不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆