debug node js app & nuxt3 app on remote server with vscode

80 views Asked by At

I am having issues getting node/vscode to map remote break points on ubuntu with a local windows ms edge / chrome.

Remote server node v18.18.0

.js serverd from ${workspaceFolder}/subdir/myproject/public

Local Vscode, edge (both latest)

1.connect vs code over aws ssm - OK

2.setup debug attach cfg in launch.json

    {
      "type": "node",
      "request": "attach",
      "name": "Attach to Remote",
      "address": "0.0.0.0",
      "port": 9229,
      "localRoot": "${workspaceFolder}/subdir/myproject", // note also tried full path
      "remoteRoot": "/home/user/mywrkspace/subdir/myproject/"
    },

step 3. vscode integrated terminal

 node --inspect=0.0.0.0:9229 src/app.js
 // full path /home/user/mywrkspace/subdir/myproject/src/app.js
 output: Debugger listening on ws://0.0.0.0:9229/88ace4bd-cde1-4110-a0f0-904c20690615
 NB: breakpoints show in red <- note

step 4. ms edge > edge://inspect/#devices > configure > target discovery settings

 n.n.n.n:9229 <- server public ip ~ allowed in firewall all ip 
  
  Remote Target #n.n.n.n <- as above
  Target(v18.18.0)
  src/app.js file:///home/user/mywrkspace/subdir/myproject/src/app.js  <- matches above
  
  open dedicated DevTools for node
  can see log from server same as in vscode terminal
  NB: no files show under sources > workspace
  

step 5. run url in edge -> no breakpoints as expected

step 6. attach vscode debugger

 "name": "Attach to Remote",
 output: Debugger attached.
 NB: breakpoints show in gery <- HERE is the problem
 

step 7. run url in edge -> no breakpoints as expected with greyed out breakpoints

Given I can see the server logs on the inspect tab the connection looks OK. What have I missed to get the breakpoints to map.

NB: at some point in the last days i did get the connection to work but since then the server config has changed so much I hav no idea what is was when it as working.

I would also like to extend this to working in nuxt3 ssr: false if possible

0

There are 0 answers