nx: After update to latest (`15.7.x`) debugger doesn't attach to breakpoints

Current Behavior

I use Javascipt debug terminal functionality from vscode, it’s similar to its auto-attach but on demands. After update to latest nx version, I can not debug my app in this way.

Expected Behavior

The debugger is attached to the process

GitHub Repo

https://github.com/tonivj5/nx-debug-bug

Steps to Reproduce

  1. git clone https://github.com/tonivj5/nx-debug-bug.git
  2. npm i
  3. put a breakpoint into any line of apps/test/src/main.ts
  4. open vscode, press Ctrl + p (or your shortcurts) and write >javascript debug terminal, <kbd>enter</kbd> image
  5. this open an auto-attachable terminal, launch the app: ./node_modules/.bin/nx serve test
  6. it works, awesome 🎉 image
  7. now, let’s go to see the bug. Stop the debugger/process
  8. git checkout no-debug
  9. npm i
  10. launch the app: ./node_modules/.bin/nx serve test
  11. now the breakpoint doesn’t work (unlinked breakpoint) 😢 Give it 2 - 3 tries image

Nx Report

- report from 15.2.1

 >  NX   Report complete - copy this into the issue template

   Node : 19.4.0
   OS   : linux x64
   npm  : 9.2.0
   
   nx : 15.2.1
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 15.2.1
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : 15.2.1
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 15.2.1
   @nrwl/js : 15.2.1
   @nrwl/linter : 15.2.1
   @nrwl/nest : 15.2.1
   @nrwl/next : Not Found
   @nrwl/node : 15.2.1
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/rollup : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/webpack : 15.2.1
   @nrwl/workspace : 15.2.1
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:

Done in 0.52s.
- report from 15.7.2
>  NX   Report complete - copy this into the issue template

   Node : 19.4.0
   OS   : linux x64
   npm  : 9.2.0
   
   nx                      : 15.7.2
   @nrwl/jest              : 15.7.2
   @nrwl/linter            : 15.7.2
   @nrwl/workspace         : 15.7.2
   @nrwl/cli               : 15.7.2
   @nrwl/devkit            : 15.7.2
   @nrwl/eslint-plugin-nx  : 15.7.2
   @nrwl/js                : 15.7.2
   @nrwl/nest              : 15.7.2
   @nrwl/node              : 15.7.2
   @nrwl/tao               : 15.7.2
   @nrwl/webpack           : 15.7.2
   typescript              : 4.8.4

Done in 0.69s.

Failure Logs

- Logs from 15.2.1

Debugger attached.

> nx run test:serve

Debugger attached.
Debugger attached.
Debugger attached.
chunk (runtime: main) main.js (main) 2.67 KiB [entry] [rendered]
webpack compiled successfully (4704159d10c4e0ee)
Type-checking in progress...
Debugger attached.
[Nest] 231210  - 02/21/2023, 9:13:47 PM     LOG [NestFactory] Starting Nest application...
[Nest] 231210  - 02/21/2023, 9:13:47 PM     LOG [InstanceLoader] AppModule dependencies initialized +22ms
[Nest] 231210  - 02/21/2023, 9:13:47 PM     LOG [RoutesResolver] AppController {/api}: +9ms
[Nest] 231210  - 02/21/2023, 9:13:47 PM     LOG [RouterExplorer] Mapped {/api, GET} route +2ms
[Nest] 231210  - 02/21/2023, 9:13:47 PM     LOG [NestApplication] Nest application successfully started +2ms
[Nest] 231210  - 02/21/2023, 9:13:47 PM     LOG 🚀 Application is running on: http://localhost:3333/api
No errors found.

- Logs from 15.7.2

Debugger attached.

> nx run test:serve

Debugger attached.
Debugger attached.
Debugger attached.
chunk (runtime: main) main.js (main) 2.67 KiB [entry] [rendered]
webpack compiled successfully (2f7d8650eed852b3)
Type-checking in progress...
No errors found.
Debugger attached.
[Nest] 230000  - 02/21/2023, 9:09:18 PM     LOG [NestFactory] Starting Nest application...
[Nest] 230000  - 02/21/2023, 9:09:19 PM     LOG [InstanceLoader] AppModule dependencies initialized +14ms
[Nest] 230000  - 02/21/2023, 9:09:19 PM     LOG [RoutesResolver] AppController {/api}: +6ms
[Nest] 230000  - 02/21/2023, 9:09:19 PM     LOG [RouterExplorer] Mapped {/api, GET} route +3ms
[Nest] 230000  - 02/21/2023, 9:09:19 PM     LOG [NestApplication] Nest application successfully started +2ms
[Nest] 230000  - 02/21/2023, 9:09:19 PM     LOG 🚀 Application is running on: http://localhost:3333/api

Additional Information

No response

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 24
  • Comments: 21 (4 by maintainers)

Most upvoted comments

This is becoming more and more frustrating. This tool should help save time, yet every single upgrade one has to spend hours and hours trying to work around basic things that stopped working. Are there no tests for this? Please fix.

Experience of work with Node is terrible right now ;/

Still a issue

+100, makes work significantly more annoying 😂

PS. Adding debugger at the beginning of your code makes functionality working again (bounds VS breakpoints which are after) but it’s only a hotfix.

Confirming the issue still remains as of version 18.3.2

Running a node CLI-based tool

+1 really a pain !

Currently using 16.3.2 and I still can’t fix the breakpoints.

Other colleagues have already commented, but @gdraganic solution works perfectly.

any update on this? I’ve tested even the latest v15.9.2 of nx and @nrwl/nest but still doesn’t work. This is very needed! Any timeframe for this to be fixed?

+1 want this back

nx 15.6.3 debug don’t works too I have tested couple nx versions and last version with working debug is 15.6.2