How do you debug a botpress-module installed in bot (botpress) in vs-code?

时间:2019-01-07 13:00:07

标签: node.js visual-studio-code bots vscode-debugger

I have a (Botpress Framework v.10.51.1) bot and I have a botpress-module installed and linked to the bot, I wanted to debug the code in the botpress-module using vscode debugger,

I added the following to my vs-code launch.json and started my bot with the command npm start --debug

{
    "type": "node",
    "request": "launch",
    "name": "Launch Program",
    "cwd": "${workspaceRoot}",
    "port": 5859,
    "program": "${workspaceRoot}/node_modules/botpress/bin/botpress",
    "runtimeExecutable": "node",
    "runtimeArgs": [
        "--debug"
    ],
    "args": [ "start" ],
    "stopOnEntry": false
}

It's still not launching the debugger in vscode , What am i missing ? How do I do this?

2 个答案:

答案 0 :(得分:1)

很难说出为什么它在Botpress 10上不起作用...

但是,如果克隆最新版本的Botpress存储库(12.0.1),则会找到以下launch.json文件:

Project WorkingProject = new Project();

WorkingProject = webService.GetProject("Testprojekt", null, null, null);

Dictionary<string, string> names = new Dictionary<string, string>();

Dictionary<string, string> types = new Dictionary<string, string>();

webService.GetElementsOfProject(WorkingProject, ref names, ref types);

这对于调试模块的后端部分非常有用。它仅要求您使用“ F5”键或转到“调试>开始调试”开始使用vscode进行调试。

希望这些信息对您有帮助。

弗朗索瓦

答案 1 :(得分:0)

@Mahesh VSCode可让您轻松调试Botpress。我创建了一个教程,可以帮助您了解在Botpress中调试问题的不同方法。

我们将使用VSCode调试和Botpress日志记录功能来查找和解决我们的bot中的错误

让我们尝试通过在ValidateEmailSignature自定义操作中添加3条其他语句调试器,console.log和bp.logger.info来调试它。

请在以下教程中查看更多信息

https://youtu.be/89dFPVbXxCw

https://aabingunz.com/debugging-in-botpress/