结合使用Stackdriver Debug和Google Cloud Functions [英] Use Stackdriver Debug with Google Cloud Functions

查看:67
本文介绍了结合使用Stackdriver Debug和Google Cloud Functions的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于使用Stackdriver调试Firebase云功能,存在类似的问题.

There is a similar question regarding Debugging Firebase Cloud Functions using Stackdriver.

但是,那里的答案似乎对使Stackdriver Debug与我正常的Cloud Function(不是Firebase)一起使用完全没有帮助.我曾尝试从Github和Cloud Source Repository采购代码-但这似乎行不通.两次我都进入侧边栏:

The answer there, however, doesn't seem to help at all with getting Stackdriver Debug to work with my normal Cloud Function (not Firebase). I've tried sourcing the code from Github and a Cloud Source Repository - but that doesn't seem to work. Both times I get in the side bar:

该项目不包含任何正在运行的应用程序.

This project does not include any running applications.

有关调试Cloud Functions的文档似乎没有提到使用Stackdriver Debug.有什么方法可以将Stackdriver Debug与Cloud Functions一起使用?

The documentation about debugging Cloud Functions seems to say nothing about using Stackdriver Debug. Is there any way to use Stackdriver Debug with Cloud Functions?

推荐答案

我最终从此视频中找到了解决方案:

I ended up finding the solution from this video: https://youtu.be/BybYim0HRmY?t=21m42s

只需将require("@google/cloud-debug")添加到index.js(或函数所在的任何文件)的顶部即可.然后将@google/cloud-debug作为依赖项添加到package.json中.

Quite simply you add require("@google/cloud-debug") to the top of your index.js (or whatever file your function is in). Then add @google/cloud-debug as a dependency in your package.json.

然后您可以将代码手动导入到Stackdriver Debug中,一切都很好.

You can then manually import the code into Stackdriver Debug and you're good to go.

这篇关于结合使用Stackdriver Debug和Google Cloud Functions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆