#Add breakpoint to Controller endpoints

16 messages · Page 1 of 1 (latest)

opal plover
#

Using Auto Attach : Always and starting app in debug mode does not trigger a breakpoint in nestjs @Controller endpoints

What am I doing wrong?

uncut vessel
#

Do the breakpoints work elsewhere?

opal plover
uncut vessel
#

Them most likely your launch configuration is wrong. Can you show the project.json?

#

Btw, since you're using VS Code, you can just launch the application through the built-in JavaScrip Debug Terminal and it should attach debugger automatically without setting up anything

#

You can open it with the + on the top right of the terminal window

opal plover
opal plover
#

Perhaps it's not possible to debug nx apps with auto-attach: always? I should have launch.json i guess then?

#

It seems adding a launch.json configuration worked well!

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceFolder}/apps/api/src/main.ts",
            "outFiles": [
                "${workspaceFolder}/dist/**/*.js"
            ],
            "skipFiles": [
                "${workspaceFolder}/node_modules/**/*.js",
                "<node_internals>/**/*.js"
            ]
        }
    ]
}

uncut vessel
#

I meant project.json from NX. But maybe you're using the old version of NX, so all configurations are in nx.json (or workspace.json). I wanted to see the 'debug' or 'serve' configuration of your NestJS application

opal plover
#

I do have nx.json and workspace.json

nx.json

{
    "npmScope": "priv",
    "implicitDependencies": {
        "workspace.json": "*",
        "package.json": {
            "dependencies": "*",
            "devDependencies": "*"
        },
        "tsconfig.json": "*",
        "tslint.json": "*",
        "nx.json": "*"
    },
    "tasksRunnerOptions": {
        "default": {
            "runner": "@nrwl/workspace/tasks-runners/default",
            "options": {
                "cacheableOperations": [
                    "build",
                    "lint",
                    "test",
                    "e2e"
                ]
            }
        }
    },
    "projects": {
        "web": {
            "tags": [
                "scope:web"
            ]
        },
        "api": {
            "tags": [
                "scope:api"
            ]
        }
    }
}
#

yes it seems I'm using older nrwl packages, example for nest: "@nrwl/nest": "12.0.7",

icy imp
#

Hi Kulic, I was curious if you managed to get your breakpoints working with Nx? In the last 3 days, my breakpoints are suddenly unbound while debugging with VSCode. This occurs even with a fresh Nx project. No idea what is causing it

#

In a fresh npx create-nx-workspace@latest, with VSCode launched with code . --disable-extensions, breakpoints do not seem to work.