You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ballerina多服务项目调试异常:仅HTTP服务可断点,GraphQL服务无法调试

为Ballerina GraphQL服务单独开启VS Code调试模式

方法1:通过Ballerina.toml配置指定调试服务

在项目根目录的Ballerina.toml文件中添加以下配置,指定仅对GraphQL服务启用调试端口:

[tool.bal.debug]
services = ["graphql_service_name"]  # 替换成你的GraphQL服务的实际名称
port = 5005  # 自定义调试端口,避免和HTTP服务调试端口冲突

方法2:使用VS Code launch.json指定调试目标

  1. 打开VS Code的运行和调试面板,点击创建launch.json文件,选择Ballerina环境。
  2. 修改生成的launch.json内容,指定仅调试GraphQL服务:
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "ballerina",
            "request": "launch",
            "name": "Debug GraphQL Service",
            "program": "${file}",  // 指向包含GraphQL服务的Ballerina文件路径
            "service": "graphql_service_name"  // 替换为你的GraphQL服务名称
        }
    ]
}

注意事项

  • 确保替换配置中的graphql_service_name为你代码里GraphQL服务的实际名称(比如服务定义里service graphqlService on new graphql:Listener(9090)中的graphqlService)。
  • 如果两个服务在同一个文件中,使用方法2时需确保program指向该文件,同时指定正确的服务名。
  • 调试时选择你创建的Debug GraphQL Service配置启动,此时只有GraphQL服务会进入调试模式,触发断点暂停。

内容的提问来源于stack exchange,提问作者chathuranga siriwardhana

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 16:32:02