vscode-js-debug icon indicating copy to clipboard operation
vscode-js-debug copied to clipboard

Unbound breakpoints in Node Typescript app launched with `tsx`

Open billomore opened this issue 8 months ago • 0 comments

Describe the bug All my breakpoints become unbound as soon as I run the app with debugger attached: launch.json:

 {
      "trace": true,
      "type": "node-terminal",
      "request": "launch",
      "name": "main-app-server:run",
      "command": "pnpm tsx watch --inspect src/main.ts",
      "localRoot": "${workspaceFolder}/services/main-app/server",
      "cwd": "${workspaceFolder}/services/main-app/server",
      "presentation": {
          "reveal": "always",
          "panel": "new"
      }
  }

The app runs fine, and until some point in near past the debugger worked fine too. There were a few upgrades since the last time it worked (upgraded Node version to 20, upgraded fastify and other core packages) so I can't pinpoint the exact change that broke it.

I don't believe that tsx produces any sourcemaps, so I'd expect to load the code from source, which I see happening; going to Debug Diagnostics -> What scripts and sourcemaps are loaded contains the list of all my source files. But each one of them has this, absolutePath verified?: ❌ Disk verification failed (does not exist or different content), while having very correct paths in url and absolutePath. Interesting thing is, that it happens only to my code; all sources loaded from node_modules show up as ✅ Verified on disk.

I've sent you the full log to email; but from what I've seen it's parsing the script and creating the source from url with no visible errors; what is strange though, as that in Debugger.scriptParsed log it says

"startLine":0,
"startColumn":0,
"endLine":1,
"endColumn":0,

for al the files,. This is the full row:

{"tag":"cdp.receive","timestamp":1748113976261,"metadata":{"connectionId":7,"message":{"method":"Debugger.scriptParsed","params":{"scriptId":"964","url":"file:///Users/ivantoropishkin/development/great-app/services/core/server/src/api/entities/user/user.repo.ts","startLine":0,"startColumn":0,"endLine":1,"endColumn":0,"executionContextId":1,"hash":"65c70ea2fff6d0aaba3c47d2da52e9c3bb490aef9900e65e05ef82983b369555","executionContextAuxData":{"isDefault":true},"isLiveEdit":false,"sourceMapURL":"","hasSourceURL":false,"isModule":true,"length":1164,"stackTrace":{"callFrames":[{"functionName":"_instantiate","scriptId":"194","url":"node:internal/modules/esm/module_job","lineNumber":133,"columnNumber":20}]},"scriptLanguage":"JavaScript","embedderName":"file:///Users/ivantoropishkin/development/great-app/services/core/server/src/api/entities/user/user.repo.ts"}}},"level":0}

Maybe it's irrelevant, but it's the only thing that caught the eye.

It's a very strange issue, and I have no clue on where to start digging it :(

To Reproduce Steps to reproduce the behavior:

  1. Create a monorepo setup with pnpm, Node 20LTS and tsx
  2. Create the launch configuration like above
  3. Run it
  4. Observe the ❌ Disk verification failed errors and all the endpoints unbound

Log File

emailed to to [email protected]

VS Code Version: Version: 1.100.2 (Universal) Commit: 848b80aeb52026648a8ff9f7c45a9b0a80641e2e Date: 2025-05-14T21:47:40.416Z Electron: 34.5.1 ElectronBuildId: 11369351 Chromium: 132.0.6834.210 Node.js: 20.19.0 V8: 13.2.152.41-electron.0 OS: Darwin arm64 24.5.0

Additional context macos 15.5 Node 20LTS Typescript 5.8.2 tsx 3.14 pnpm monorepo

billomore avatar May 24 '25 22:05 billomore