我似乎无法在 Firebase Documentation 中找到此问题的解决方案.
我想在本地测试我的 functions.https.onCall
函数。是否可以使用 shell 或以某种方式将我的客户端(启用了 firebase SDK)连接到本地服务器?
我希望避免每次都为了测试 onCall
函数的更改而进行部署。
我的代码
功能:
exports.myFunction = functions.https.onCall((data, context) => {
// Do something
});
客户:
const message = { message: 'Hello.' };
firebase.functions().httpsCallable('myFunction')(message)
.then(result => {
// Do something //
})
.catch(error => {
// Error handler //
});
最佳答案
对于本地,您必须调用(在 firebase.initializeApp 之后)
firebase.functions().useFunctionsEmulator('http://localhost:5000')
关于firebase - 如何在本地测试 `functions.https.onCall` firebase云功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50884534/