VSC. Debugger gets disconnected, in addition breakpoints doesn't synchronize. Why?

30 Views Asked by At

I use node and next 14.1, OS is ubuntu 22.04

I've been running the localhost with npx nx run inspec:serve:development command. It works as expected.

Recently, I wanted to debug some stuff, so I googled for a while and build this configuration for my launch.json , obviously adapted it to my stuff names

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "app-name",
      "type": "node",
      "request": "launch",
      "runtimeExecutable": "npx",
      "runtimeArgs": [
        "nx",
        "run",
        "app-name:serve",
        "-r",
        "ts-node/register",
        "-r",
        "tsconfig-paths/register"
      ],
      "outputCapture": "std",
      "internalConsoleOptions": "openOnSessionStart",
      "console": "internalConsole",
      "env": {
        "TS_NODE_IGNORE": "false",
        "TS_NODE_PROJECT": "${workspaceFolder}/app-name/tsconfig.json"
      },
      "cwd": "${workspaceFolder}"
    }
  ]
}

I'm not really sure if it's right, it launches my environment and catches exceptions and shows logs, so I think it's fine. The problem is, the debugger disconnects every time it connects before giving any feedback. Debugger getting disconected... Fun fact, it's able to debug the exceptions. It synchronizes if I check the Uncaught/Caught Exceptions checkbox. Exception is debugging

I've also tried to directly launch the launch command (npx nx...) through the javascript debug console. Ended with the same result, with a longer output ofc.

This is the log.

Debugger attached.
Debugger attached.

nx run app-name:serve:development

Debugger attached.
Debugger attached.
Debugger attached.
   ▲ Next.js 14.1.0
   - Local:        http://localhost:4200
   - Environments: .env.local
Debugger attached.
Waiting for the debugger to disconnect...
 ✓ Ready in 38.3s
 ○ Compiling /api/auth/[...nextauth] ...
 ⚠ ../node_modules/web-worker/node.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
../node_modules/web-worker/node.js
../node_modules/geotiff/dist-module/worker/decoder.js
../node_modules/geotiff/dist-module/pool.js
../node_modules/geotiff/dist-module/geotiff.js
../node_modules/ol/source/GeoTIFF.js
../node_modules/ol/source.js
../common/components/map/openlayers/OpenLayers.tsx
../common/components/map/clientMap.tsx
Debugger attached.
Waiting for the debugger to disconnect...
 ⨯ ../node_modules/ol/Map.js (366:21) @ document
 ⨯ Internal error: ReferenceError: document is not defined
    at new Map (../node_modules/ol/Map.js:326:26)
    at new RMap (../node_modules/rlayers/dist/RMap.js:32:19)
    at (...)
null
{ error: 'invalid_grant', error_description: 'Refresh token expired' }
 ⚠ ../node_modules/web-worker/node.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
../node_modules/web-worker/node.js
../node_modules/geotiff/dist-module/worker/decoder.js
../node_modules/geotiff/dist-module/pool.js
../node_modules/geotiff/dist-module/geotiff.js
../node_modules/ol/source/GeoTIFF.js
../node_modules/ol/source.js
../common/components/map/openlayers/OpenLayers.tsx
../common/components/map/clientMap.tsx
 ⚠ ../node_modules/web-worker/node.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
../node_modules/web-worker/node.js
../node_modules/geotiff/dist-module/worker/decoder.js
../node_modules/geotiff/dist-module/pool.js
../node_modules/geotiff/dist-module/geotiff.js
../node_modules/ol/source/GeoTIFF.js
../node_modules/ol/source.js
../common/components/map/openlayers/OpenLayers.tsx
../common/components/map/clientMap.tsx
 ⚠ ../node_modules/web-worker/node.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
../node_modules/web-worker/node.js
../node_modules/geotiff/dist-module/worker/decoder.js
../node_modules/geotiff/dist-module/pool.js
../node_modules/geotiff/dist-module/geotiff.js
../node_modules/ol/source/GeoTIFF.js
../node_modules/ol/source.js
../common/components/map/openlayers/OpenLayers.tsx
../common/components/map/clientMap.tsx
 ⚠ ../node_modules/web-worker/node.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
../node_modules/web-worker/node.js
../node_modules/geotiff/dist-module/worker/decoder.js
../node_modules/geotiff/dist-module/pool.js
../node_modules/geotiff/dist-module/geotiff.js
../node_modules/ol/source/GeoTIFF.js
../node_modules/ol/source.js
../common/components/map/openlayers/OpenLayers.tsx
../common/components/map/clientMap.tsx
 ⚠ ../node_modules/web-worker/node.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
../node_modules/web-worker/node.js
../node_modules/geotiff/dist-module/worker/decoder.js
../node_modules/geotiff/dist-module/pool.js
../node_modules/geotiff/dist-module/geotiff.js
../node_modules/ol/source/GeoTIFF.js
../node_modules/ol/source.js
../common/components/map/openlayers/OpenLayers.tsx
../common/components/map/clientMap.tsx
**Debugger attached.**
{ error: 'invalid_grant', error_description: 'Refresh token expired' }
 ⚠ ../node_modules/web-worker/node.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
../node_modules/web-worker/node.js
../node_modules/geotiff/dist-module/worker/decoder.js
../node_modules/geotiff/dist-module/pool.js
../node_modules/geotiff/dist-module/geotiff.js
../node_modules/ol/source/GeoTIFF.js
../node_modules/ol/source.js
../common/components/map/openlayers/OpenLayers.tsx
../common/components/map/clientMap.tsx
{ error: 'invalid_grant', error_description: 'Refresh token expired' }
**Waiting for the debugger to disconnect...
** ⚠ ../node_modules/web-worker/node.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
../node_modules/web-worker/node.js
../node_modules/geotiff/dist-module/worker/decoder.js
../node_modules/geotiff/dist-module/pool.js
../node_modules/geotiff/dist-module/geotiff.js
../node_modules/ol/source/GeoTIFF.js
../node_modules/ol/source.js
../common/components/map/openlayers/OpenLayers.tsx
../common/components/map/clientMap.tsx
{ error: 'invalid_grant', error_description: 'Refresh token expired' }
{ error: 'invalid_grant', error_description: 'Refresh token expired' }
 ⚠ ../node_modules/web-worker/node.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
../node_modules/web-worker/node.js
../node_modules/geotiff/dist-module/worker/decoder.js
../node_modules/geotiff/dist-module/pool.js
../node_modules/geotiff/dist-module/geotiff.js
../node_modules/ol/source/GeoTIFF.js
../node_modules/ol/source.js
../common/components/map/openlayers/OpenLayers.tsx
../common/components/map/clientMap.tsx
 ⚠ ../node_modules/web-worker/node.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
../node_modules/web-worker/node.js
../node_modules/geotiff/dist-module/worker/decoder.js
../node_modules/geotiff/dist-module/pool.js
../node_modules/geotiff/dist-module/geotiff.js
../node_modules/ol/source/GeoTIFF.js
../node_modules/ol/source.js
../common/components/map/openlayers/OpenLayers.tsx
../common/components/map/clientMap.tsx
chatrooms [
  Chatroom {
    chatroom_id: 1,
    chatroom_name: 'Test1',
    chatroom_users: { users: [Array] }
  },
  Chatroom {
    chatroom_id: 2,
    chatroom_name: 'Test2',
    chatroom_users: { users: [Array] }
  },
  Chatroom {
    chatroom_id: 3,
    chatroom_name: 'NombreLargoTest1',
    chatroom_users: { users: [Array] }
  },
  Chatroom {
    chatroom_id: 4,
    chatroom_name: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
    chatroom_users: { users: [Array] }
  }
]
chatrooms [
  Chatroom {
    chatroom_id: 1,
    chatroom_name: 'Test1',
    chatroom_users: { users: [Array] }
  },
  Chatroom {
    chatroom_id: 2,
    chatroom_name: 'Test2',
    chatroom_users: { users: [Array] }
  },
  Chatroom {
    chatroom_id: 3,
    chatroom_name: 'NombreLargoTest1',
    chatroom_users: { users: [Array] }
  },
  Chatroom {
    chatroom_id: 4,
    chatroom_name: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
    chatroom_users: { users: [Array] }
  }
]

Yes, there's lot's of exceptions, but as you can see, I'm getting the console logs when I poke stuff.

I asked a friend of mine to run the code and he was able to do it through the VSC Javascript Debug Console on Windows so I'm suspecting it's Ubuntu's doing.

Do you guys may give me some clue?

I've given permissions to the vscode files as the answer of this topic (just in case it was lacking some) text I've tried different launch.json configurations and got similar outputs. Cannot link those since they are from around various topics. Also tried enabling the sourceMap property in project.json and launch.json

I want to know if I'm missing any obvious thing or so, don't know what else could I try.

(Just in case, I've already checked if this issue is already solved elsewhere)

1

There are 1 best solutions below

0
Vxvy_ On

After I run chown user:user -hR . in my repository root the debugger started working propperly ;_;