【发布时间】:2019-06-09 19:17:17
【问题描述】:
我正在使用 firebase functions:shell 测试我的 Cloud Functions 并意识到它似乎没有模拟调用之间的内存状态。
let flag = false;
exports.test = functions.https.onCall(async (data, context) => {
console.log(flag); // this is still false on second call :-(
flag = true;
return true;
});
我知道函数应该是无状态的,但正如文档所说“Cloud Functions 经常回收先前调用的执行环境。”这在生产中有效。 有谁知道有没有办法在本地测试这个?
【问题讨论】:
标签: firebase google-cloud-functions firebase-cli