Azure Functions + Node.js + vscode:启动配置以调试多个Azure函数Func? [英] Azure Functions + nodejs + vscode: launch config to debug multiple azure function funcs?

查看:58
本文介绍了Azure Functions + Node.js + vscode:启动配置以调试多个Azure函数Func?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在所有使用http触发器的教程中,.vscode启动文件都具有以下内容:

In all the tutorials using http triggers, the .vscode launch file has this:

    {
      "name": "Attach to Javascript Functions",
      "type": "node",
      "request": "attach",
      "port": 9229,
      "preLaunchTask": "func: host start"
    }

因此,现在我在同一功能应用程序中添加了第二个功能.它使用服务错误触发器.我想在部署到天蓝色之前在本地对其进行测试.现在,如何扩展启动配置?我可以复制块并更改名称,但是调试器将如何知道要启动哪个功能?谢谢!

So now I've added a second function in the same function app. It uses a service bug trigger. I'd like to test it locally before deploying to azure. So now how do I extend the launch configurations? I can copy the block and change the name but how will the debugger know which func to kick off? Thanks!

推荐答案

实际上不需要修改.检查器(调试器)未附加到任何特定功能,而是为功能节点工作程序启用了该功能,该工作程序加载了我们创建的所有功能.

No modification required actually. The inspector(debugger) is not attached to any specific function, instead, it is enabled for the function node worker, which loads all functions we create.

当我们调试时,我们可以看到

When we debug we could see

Starting language worker process:node  --inspect=9229
"C:\Users\UserName\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\node\dist/src/nodejsWorker.js" --host ...
node process with Id=2276 started
Generating 2 job function(s)
Debugger listening on ws://127.0.0.1:9229/0c8f2c9a-80cd-4ab6-914e-1c65d29f43c6

这篇关于Azure Functions + Node.js + vscode:启动配置以调试多个Azure函数Func?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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