Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breakpoints become unbound immediately upon attaching to nodejs process #1257

Closed
jschank opened this issue May 6, 2022 · 3 comments
Closed
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)

Comments

@jschank
Copy link

jschank commented May 6, 2022

I am trying to debug a nestjs application, written in typescript. And I am attempting to attach to the process, so I can hit breakpoints.
The breakpoints become unbound immediately upon attaching to the process.

Here is the trace file
vscode-debugadapter-cb19f722.json.gz

Here is my Launch.json

{
  // 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": [
    {
      "name": "Attach to Nest",
      "type": "node",
      "request": "attach",
      "port": 9229,
      "restart": true,
      "skipFiles": [
        "<node_internals>/**"
      ],
      "trace": true,
    }
  ]
}

I know the debugger is attaching to the process because I see this emitted in the console

Debugger listening on ws://localhost:9229/d8180938-a9d6-46d8-81a3-814a66b98348
Debugger listening on ws://localhost:9229/d8180938-a9d6-46d8-81a3-814a66b98348
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.

My angular.json file has this...

"serve": {
    "configurations: {
            "dev": {
              "buildTarget": "nest:build:dev",
              "inspect": true,
              "port": 9229
            }
    }
}

Any help is appreciated, I've googled unbound breakpoints, and tried many things. None of which made any difference.

Thanks,
John Schank

@connor4312
Copy link
Member

It looks like you should set "cwd": "${workspaceFolder}/workspace". Nest.js provides Webpack paths, which are relative, so we need to know where to resolve them from. In your case, it looks like you have it in a nested directory, which requires this adjustment.

@connor4312 connor4312 closed this as not planned Won't fix, can't repro, duplicate, stale May 6, 2022
@connor4312 connor4312 added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label May 6, 2022
@jschank
Copy link
Author

jschank commented May 6, 2022

Connor, your advice was spot on, and solved the problem. I've seen you reply to lots of other issues as well, in my search for an answer to my particular problem.

Can you clue me into how you solved it so quickly? None of the resources I found online mentioned that property.

In any case, I really appreciate your swift response. (they don't pay you enough)

@connor4312
Copy link
Member

I saw that you set a breakpoint in

/Users/jschank/Mobius/mobius-repo/workspace/apps/nest/src/app/trm/merge-utility/trm-merge-utility-software-governance.controller.ts

And then this line of the log file:

"SourceMap: mapping webpack:///./apps/nest/src/app/trm/merge-utility/trm-merge-utility-software-governance.controller.ts =>
/Users/jschank/Mobius/mobius-repo/./apps/nest/src/app/trm/merge-utility/trm-merge-utility-software-governance.controller.ts, via sourceMapPathOverrides entry - /^webpack:\\/\\/.*?\\/(.*?)$/i"

showed me that the folder was missing.

I want to improve the setup experience: #1214

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

2 participants