[英](ERROR: internal) Testing Firebase functions using React Native Expo
I'm trying to test my firebase functions in my React Native Expo app.我正在尝试在我的 React Native Expo 应用程序中测试我的 firebase 函数。 Here's my initialization code:这是我的初始化代码:
import { connectFunctionsEmulator, getFunctions } from 'firebase/functions'
// ...Initialize app
export const fucntions = getFunctions()
connectFunctionsEmulator(fucntions, "localhost", 5001)
I then have code which maps functions in an object:然后我有在 object 中映射函数的代码:
import { httpsCallable } from "firebase/functions";
import { fucntions } from "../../firebase";
export default {
helloFirebase: httpsCallable(fucntions, "helloFirebase")
}
And I call the function as follows:我调用 function 如下:
functionsObj.helloFirebase({ myParam: "Hello!" })
.then((res) => {
console.log(res)
})
.catch((error) => {
console.log(error.message)
})
But when I call the function I get the following, very small and unspecific error message in the console:但是当我调用 function 时,我在控制台中收到以下非常小且不明确的错误消息:
ERROR: internal
I'm guessing it's something to do with not being able to access localhost, but I still don't know how to fix the issue.我猜这与无法访问本地主机有关,但我仍然不知道如何解决这个问题。
Any help would be appreciated, thanks!任何帮助将不胜感激,谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.