AngularFire httpsCallable Object(...) 不是函数 [英] AngularFire httpsCallable Object(...) is not a function
问题描述
我想在我的 Ionic 3 应用程序中调用 httpsCallable 函数.我正在尝试遵循这些文档:https://firebase.google.com/docs/functions/可调用
我试过了:
const newGame = (firebase as any).functions().httpsCallable('findCreateGame');newGame({}).then(function(result) {console.log("在这里.");});
结果:
<块引用>ERROR TypeError: WEBPACK_IMPORTED_MODULE_5_firebase_functions.functions 不是函数
我还在 angularfire 中尝试了新实现的包装器:
const newGame = this.afFunctions.httpsCallable('findCreateGame');newGame({}).then(function(result) {console.log("在这里.");});
<块引用>
ERROR TypeError: Object(...) is not a function
有没有人有这方面的经验?如果有帮助,这是添加功能的拉取请求.https://github.com/angular/angularfire2/pull/1532
编辑---
这段代码实际上调用了 Cloud 函数,即使它抛出相同的不是函数"错误:
const newGame = this.afFunctions.httpsCallable('findCreateGame');新游戏();
我不确定如何调用该函数,即使 newGame
是一个对象而不是一个函数引用.
Object(...) is not a function
被抛出,因为您运行的是 rxjs 5,而不是 6.
如果您升级,该功能将按预期执行.
请参阅 rxjs 迁移文档,了解有关更改的更多详细信息5 到 6 之间.
I want to call a httpsCallable function in my Ionic 3 app. I am attempting to follow these docs: https://firebase.google.com/docs/functions/callable
I tried:
const newGame = (firebase as any).functions().httpsCallable('findCreateGame');
newGame({}).then(function(result) {
console.log("In here.");
});
Which resulted in:
ERROR TypeError: WEBPACK_IMPORTED_MODULE_5_firebase_functions.functions is not a function
I also tried the newly implemented wrapper in angularfire:
const newGame = this.afFunctions.httpsCallable('findCreateGame');
newGame({}).then(function(result) {
console.log("In here.");
});
ERROR TypeError: Object(...) is not a function
Does anyone have any experience with this yet? Here is the pull request to add the functionality if that helps at all. https://github.com/angular/angularfire2/pull/1532
EDIT---
This code actually calls the Cloud function even though it throws the same 'Not a function' error:
const newGame = this.afFunctions.httpsCallable('findCreateGame');
newGame();
I'm not sure how else to call the function, even though newGame
is an object and not a function reference.
The Object(...) is not a function
is thrown because you're running rxjs 5, rather than 6.
If you upgrade, the function will perform as expected.
See the rxjs migration doc for more details on the changes between 5 and 6.
这篇关于AngularFire httpsCallable Object(...) 不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!