【问题标题】:Use Stackdriver debugger with cloud functions for Firebase in Typescript在 Typescript 中使用 Stackdriver 调试器和 Firebase 的云功能
【发布时间】:2018-10-24 14:56:42
【问题描述】:

我想在 Firebase 的云功能中连接 stackdriver 调试代理。以下是我如何设置堆栈驱动程序代理以在我要调试的功能上使用。

// For debugging purposes
const debug = require('@google-cloud/debug-agent').start({  allowExpressions: true,
});

export async function listen() {
     await debug.isReady();
}

然后像下面这样使用它

export async function exampleCallableWrapper(
  data: any,
  context: functions.https.CallableContext
) {
  await listen();
  data.Id = shortid.generate();
// Do something

  return 
}

例如,我想查看数据对象。设置断点后快照不显示任何内容。

  • 我确实将断点放在了函数所在的原始functions/src文件夹中。

  • 我还尝试手动将其指向 lib 文件夹,但没有成功,因为我必须手动进行。

  • 我确实看到函数启动并成功返回,没有问题,但在堆栈驱动程序调试器页面中没有显示任何内容

函数和stackdriver的版本如下

"@google-cloud/debug-agent": "^3.0.0",

"firebase-functions": "^2.0.5",

【问题讨论】:

    标签: typescript firebase google-cloud-functions stackdriver


    【解决方案1】:

    这个solution 使用 Cloud Function 实现 Stackdriver 调试器。与您的代码相比,查看他们如何实现它可能会很有用。

    【讨论】:

    猜你喜欢
    • 2017-10-28
    • 2019-06-22
    • 2021-04-08
    • 1970-01-01
    • 1970-01-01
    • 2020-11-24
    • 2018-02-24
    • 1970-01-01
    • 2021-06-07
    相关资源
    最近更新 更多