gpt4 book ai didi

Firebase函数模拟器useFunctionsEmulator()方法不起作用

转载 作者:行者123 更新时间:2023-12-02 00:50:59 32 4
gpt4 key购买 nike

我目前正在研究在本地测试云功能的方法。
我发现了几种方法,但是使用Firebase模拟器和useFunctionsEmulator()方法似乎很棒。在https://firebase.google.com/docs/functions/local-emulator上,他们没有提及该方法,但是我在此URL How to test `functions.https.onCall` firebase cloud functions locally?上找到了它。

但是,当我运行firebase emulator:start和console.log(firebase.functions()。useFunctionsEmulator('http://localhost:5001')时,它只是显示未定义。

我尝试了几个关于原点的输入,但是没有改变。互联网上关于此的信息很少,我认为这是因为它是Alpha,所以请对此提供帮助。

最佳答案

在客户端中初始化Firebase应用后,我通过调用useFunctionsEmulator()方法使模拟器工作并处理本地请求。事先调用它会导致错误。

firebase.initializeApp(config);
firebase.functions().useFunctionsEmulator("http://localhost:5001");

关于Firebase函数模拟器useFunctionsEmulator()方法不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57684682/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com