Debugging Terraform CDK with Visual Studio Code (Python)?

Hi, I am trying to debug a terraform CDK (written in Python) from Visual Studio Code. Here’s the launch.json :

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug Terraform CDK Python",
            "type": "node",
            "request": "launch",
            "program": "/home/rootuser/.nvm/versions/node/v20.15.1/bin/cdktf",
            "args": [
                "deploy",
                "--app .venv/lib/python3.10/site-packages/cdktf/__init__.py"
            ],
            "cwd": "${workspaceFolder}",
            "env": {
                "PATH": "/home/devanshjain/.nvm/versions/node/v20.15.1/bin:/home/rootuser/DIRNAME/temp/PROJECTNAME/.venv/bin:${env:PATH}",
                "PYTHON": "/home/rootuser/DIRNAME/temp/PROJECTNAME/.venv/bin/python"
            },
            "console": "integratedTerminal",
            "internalConsoleOptions": "neverOpen",
            "preLaunchTask": "Ensure Environment"
        }
    ]
}

The debugger starts but fails to connect, and the logger reads:

⠏  Synthesizing
[2024-08-01T17:47:52.456] [ERROR] default - Debugger attached.

[2024-08-01T17:47:52.472] [ERROR] default - Waiting for the debugger to disconnect...

Can someone help? :slight_smile: