microsoft / vscode-js-debug

A DAP-compatible JavaScript debugger. Used in VS Code, VS, + more
MIT License
1.67k stars 283 forks source link

Debugging Node + attach to process (PickProcess) not working (wrong debug port) #2063

Closed jbgraug closed 2 months ago

jbgraug commented 2 months ago

Does this issue occur when all extensions are disabled?: Yes/No Yes

Steps to Reproduce: I'm using node v18.20.3

  1. Create an app.js file with the content setInterval(()=>{console.log('alive')}, 1000)
  2. Start 2 or more node processes with node --inspect=:9223 app.js and --inspect=:9224 app.js`, etc.
  3. Click on Run & debug and select "Attach by process ID" { "name": "Attach by Process ID", "processId": "${command:PickProcess}", "request": "attach", "skipFiles": ["<node_internals>/**"], "type": "node" },
  4. On the "PickProcess" dropdown you should see at least the 2 processes started on step 1)
  5. Pick one of them image
  6. Regardless the one wich is picked, the debugger won't be attached (timeout)

The default debug port 9229 seems to be used by vscode for both procesess, wich is not the specified by any of the running node processes.