Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code remote debug to NodeJs in cluster

I am trying to remotely debug NodeJs application, which uses clusters. When I run my app locally, and I am attaching to it, VS Code see child processes and breakpoints works:

enter image description here

VS Code Config:

{
  "name": "Attach",
  "type": "node",
  "request": "attach",
  "port": 50131,
  "internalConsoleOptions": "neverOpen",
  "skipFiles": ["<node_internals>/**"],
  "autoAttachChildProcesses": true
},

VS Code result:

enter image description here

However, in remote host, process starts same way, same port, I am able to attach debugger to it, but VS Code Can't see child processes and source maps (to connect local files breakpoints to remote, in debug config I have correct host address):

enter image description here

So the difference between local env and remote is Windows vs Unix, and in remote app is run via Forever (module, however, even Forever, without clusters remote debugging works correct).

Where can be an issue?

EDIT: I can't use SSH debug in my organization.

like image 768
Michał Wojas Avatar asked Apr 06 '20 16:04

Michał Wojas


1 Answers

Give vscode extension Remote SSH a try. It let you run remote code locally.

https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh

like image 93
Aviv Lo Avatar answered Nov 19 '22 03:11

Aviv Lo