作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前正在研究在本地测试云功能的方法。
我发现了几种方法,但是使用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/
我是一名优秀的程序员,十分优秀!