【问题标题】:firebase functions:shell does not emulate state of memory between invocationsfirebase 函数:shell 不模拟调用之间的内存状态
【发布时间】: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


    【解决方案1】:

    目前没有办法做到这一点。这个问题正在 GitHub 上讨论。 You can follow the issue here.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-23
      • 1970-01-01
      • 2021-06-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多