【发布时间】:2020-11-24 21:09:48
【问题描述】:
所以,我正在开发一个使用 Firebase 来实现许多功能的 React 项目。 现在我正在尝试在其中使用一些 HTTPS 可调用函数。
但我导入“firebase/functions”模块的方式似乎不正确。它给了我这个错误:
TypeError: Cannot read property 'httpsCallable' of undefined
以下是我如何进行导入和设置:
import app from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';
import 'firebase/functions';
const config = {
// the config info here
};
class Firebase {
constructor() {
app.initializeApp(config);
this.auth = app.auth();
this.db = app.firestore();
this.functions = app.functions();
}
// trying to call the function
doCreatePlanner = this.functions.httpsCallable('createPlanner')
谁能指出我正确的方向?
【问题讨论】:
标签: javascript reactjs firebase google-cloud-functions