Azure Functions:如何在 WebStorm 中进行调试?
Azure Functions: How to debug in WebStorm?
azure-functions-cli offers a way to kickoff debugging,但这些说明似乎是 Visual Studio 具体的。
我尝试通过在 WebStorm 中设置 运行 配置以将 JavaScript 文件指向:
来使用与无服务器类似的技巧
\node_modules\azure-functions-cli\lib\main.js
然后传递应用程序参数:
run myFunctionName --debug
这成功地运行使用 Azure 的工具实现了功能,但是 WebStorm 都尝试设置调试端口;当 Azure window 打开时,它会设置自己的调试端口。
来自网络风暴:
C:\Program Files (x86)\JetBrains\WebStorm 2016.2.3\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" --debug-brk=60168 --expose_debug_as=v8debug C:\Users\username\AppData\Roaming\npm\node_modules\azure-functions-cli\lib\main.js run myfunction --debug
Debugger listening on [::]:60168
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException:
同样,Azure-cli 说它打开了一个调试端口,但它们不匹配。
因此,调用函数时设置的断点将被忽略(尽管它成功 运行)。
有人知道如何正确配置它以便能够使用 WebStorm 进行调试吗?
Azure-Functions-CLI 已重命名为 azure-functions-core-tools。如果您仍然有 Azure-Functions-CLI,请参阅本文末尾的旧回复 post。
如果您运行正在使用新的 azure-functions-core-tools,他们似乎破坏了 运行 远程调试器的功能:-(。
我打开了以下问题,如果他们告诉我其他情况,我会更新:
https://github.com/Azure/azure-functions-core-tools/issues/378
幸运的是,azure-functions-core 工具的新 Beta 版并没有阻止它在其他操作系统上 运行ning 的所有 C# 疯狂,并且需要远程调试器。要安装该版本,您可以使用:
npm i -g azure-functions-core-tools@core
安装该版本后,您就可以使用标准 Node 运行时间启动程序了。
- 在 WebStorm 中从 运行 -> 编辑配置创建一个新的 "Node.JS"。
- 为调试命名。
- 将 JavaScript 文件设置为:
~\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js
注意:以上假设您在具有全局标志的 Windows 机器上安装了 Azure Functions。
- 将应用程序参数设置为:start --debug VSCODE
- 编辑文件“.vscode\launch.json”并将节点的调试端口更改为 9229。
在 WebStorm 中选择 运行-> 调试:"What_You_Named_the_Remote_Profile"
添加一些断点。
导航到您的 API end-point 并查看 break-points 工作。
注意:默认情况下,函数显示在 http://localhost:7071/api/functionName
-------------------- 已编辑但为后代保留 --------------
好的,看起来你不能通过本地调试来做到这一点,但可以在 WebStorm 中使用 "Remote Debugging"。
- 在 WebStorm 中从 运行 -> 编辑配置创建一个新的 "Node.JS Remote Debug"。
- 为调试命名。
- 点击上面写着 "Before Launch: External Tool" 的 + 号,然后选择 "Run External Tool"。
- 再次点击 + 号并像 screen-shot 一样填写它(假设您全局安装了 Azure Function CLI)。
注意:以上截图已根据最新版本的 Azure Functions CLI/.早期版本要求您声明应用程序名称,并且不需要 --debug 进行调试。因此,如果您没有更新到最新版本的 Azure Functions CLI(现在称为 Azure-Functions-Core-Tools),您可能需要在参数字段中包含 "run MyApp"。
在 WebStorm 中选择 运行-> 调试:"What_You_Named_the_Remote_Profile"
添加一些断点。
导航到您的 API end-point 并查看 break-points 工作。
注意:默认情况下,函数显示在 http://localhost:7071/api/functionName
- 将此添加到您的 local.setting.json 文件的值下:"languageWorkers:node:arguments": "--inspect=5858"
- 点击编辑配置。单击加号图标并选择附加到节点。js/Chrome
- 为选项填写这些值:主机:localhost - 端口:5858 并将 Attac 设置为 "Crhome or Nod.js>6.3 started with --inpect"
选项
- 启动函数和运行调试器
看这张图:https://i.stack.imgur.com/hnC74.png
azure-functions-cli offers a way to kickoff debugging,但这些说明似乎是 Visual Studio 具体的。
我尝试通过在 WebStorm 中设置 运行 配置以将 JavaScript 文件指向:
来使用与无服务器类似的技巧\node_modules\azure-functions-cli\lib\main.js
然后传递应用程序参数:
run myFunctionName --debug
这成功地运行使用 Azure 的工具实现了功能,但是 WebStorm 都尝试设置调试端口;当 Azure window 打开时,它会设置自己的调试端口。
来自网络风暴:
C:\Program Files (x86)\JetBrains\WebStorm 2016.2.3\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" --debug-brk=60168 --expose_debug_as=v8debug C:\Users\username\AppData\Roaming\npm\node_modules\azure-functions-cli\lib\main.js run myfunction --debug
Debugger listening on [::]:60168
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException:
同样,Azure-cli 说它打开了一个调试端口,但它们不匹配。
因此,调用函数时设置的断点将被忽略(尽管它成功 运行)。
有人知道如何正确配置它以便能够使用 WebStorm 进行调试吗?
Azure-Functions-CLI 已重命名为 azure-functions-core-tools。如果您仍然有 Azure-Functions-CLI,请参阅本文末尾的旧回复 post。
如果您运行正在使用新的 azure-functions-core-tools,他们似乎破坏了 运行 远程调试器的功能:-(。
我打开了以下问题,如果他们告诉我其他情况,我会更新: https://github.com/Azure/azure-functions-core-tools/issues/378
幸运的是,azure-functions-core 工具的新 Beta 版并没有阻止它在其他操作系统上 运行ning 的所有 C# 疯狂,并且需要远程调试器。要安装该版本,您可以使用:
npm i -g azure-functions-core-tools@core
安装该版本后,您就可以使用标准 Node 运行时间启动程序了。
- 在 WebStorm 中从 运行 -> 编辑配置创建一个新的 "Node.JS"。
- 为调试命名。
- 将 JavaScript 文件设置为: ~\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js
注意:以上假设您在具有全局标志的 Windows 机器上安装了 Azure Functions。
- 将应用程序参数设置为:start --debug VSCODE
- 编辑文件“.vscode\launch.json”并将节点的调试端口更改为 9229。
在 WebStorm 中选择 运行-> 调试:"What_You_Named_the_Remote_Profile"
添加一些断点。
导航到您的 API end-point 并查看 break-points 工作。
注意:默认情况下,函数显示在 http://localhost:7071/api/functionName
-------------------- 已编辑但为后代保留 --------------
好的,看起来你不能通过本地调试来做到这一点,但可以在 WebStorm 中使用 "Remote Debugging"。
- 在 WebStorm 中从 运行 -> 编辑配置创建一个新的 "Node.JS Remote Debug"。
- 为调试命名。
- 点击上面写着 "Before Launch: External Tool" 的 + 号,然后选择 "Run External Tool"。
- 再次点击 + 号并像 screen-shot 一样填写它(假设您全局安装了 Azure Function CLI)。
注意:以上截图已根据最新版本的 Azure Functions CLI/.早期版本要求您声明应用程序名称,并且不需要 --debug 进行调试。因此,如果您没有更新到最新版本的 Azure Functions CLI(现在称为 Azure-Functions-Core-Tools),您可能需要在参数字段中包含 "run MyApp"。
在 WebStorm 中选择 运行-> 调试:"What_You_Named_the_Remote_Profile"
添加一些断点。
导航到您的 API end-point 并查看 break-points 工作。
注意:默认情况下,函数显示在 http://localhost:7071/api/functionName
- 将此添加到您的 local.setting.json 文件的值下:"languageWorkers:node:arguments": "--inspect=5858"
- 点击编辑配置。单击加号图标并选择附加到节点。js/Chrome
- 为选项填写这些值:主机:localhost - 端口:5858 并将 Attac 设置为 "Crhome or Nod.js>6.3 started with --inpect" 选项
- 启动函数和运行调试器
看这张图:https://i.stack.imgur.com/hnC74.png