nx icon indicating copy to clipboard operation
nx copied to clipboard

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

Open tonivj5 opened this issue 1 year ago • 24 comments

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, enter 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

tonivj5 avatar Feb 21 '23 20:02 tonivj5

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

tagplus5 avatar Feb 21 '23 22:02 tagplus5

+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.

Dzixxx avatar Feb 24 '23 12:02 Dzixxx

@Dzixxx what executor do you use? If you create new project with nx 15.7.2 and add nest app, default executor will be @nrwl/js:node and you solution don't works.

 "serve": {
      "executor": "@nrwl/js:node",
      "options": {
        "buildTarget": "api:build"
      },
      "configurations": {
        "production": {
          "buildTarget": "api:build:production"
        }
      }
    },

tagplus5 avatar Feb 24 '23 20:02 tagplus5

I'm using @nrwl/node:node but I also figured out that it works only if U will use at the beginning keyword debugger. After removing it it will work as long as U have it connected 😢

Dzixxx avatar Feb 27 '23 09:02 Dzixxx

+1 really a pain !

alljinx avatar Mar 01 '23 17:03 alljinx

Experience of work with Node is terrible right now ;/

krzysztofKubiakVizlib avatar Mar 02 '23 19:03 krzysztofKubiakVizlib

As a temporary workaround please try this: https://github.com/nrwl/nx/issues/14708#issuecomment-1457996600

gdraganic avatar Mar 07 '23 11:03 gdraganic

Still a issue

slaby93 avatar Mar 16 '23 07:03 slaby93

+1 want this back

driley-abbvie avatar Mar 16 '23 18:03 driley-abbvie

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.

ziacik avatar Apr 10 '23 14:04 ziacik

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?

tomachianura avatar Apr 12 '23 18:04 tomachianura

Also bumping up. This just stopped working for me one day, and it is very frustrating.

michaelsharpe avatar May 06 '23 05:05 michaelsharpe

Really frustrating! still breakpoints are not attaching on "nx": "16.1.0",

nftgeek avatar May 09 '23 03:05 nftgeek

Still not working, so frustrating

lukepetrocochino avatar May 18 '23 12:05 lukepetrocochino

As a temporary workaround please try this: #14708 (comment)

You should definitly use this as a temporary workaround...

alljinx avatar May 18 '23 13:05 alljinx

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

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

drackp2m avatar Jun 12 '23 21:06 drackp2m

I am curious if anyone has upgraded to 16.9.1 to see if breakpoints work?

The workaround works for me, but it does seem like it takes a bit longer to hot-reload after changes are made. Not sure if it's related to the work-around.

goinnovise avatar Sep 26 '23 14:09 goinnovise

Indeed, I upgraded to nx 16.9.1, but also my docker image to node:20.7-alpine3.18, and I can confirm that everything works great without having to apply @gdraganic's solution.

In my case, I am not experiencing performance problems, indeed, possibly because I have upgraded my node version from 20.2 to 20.7, I have noticed that both the change detection and transpilation process is considerably faster.

drackp2m avatar Sep 26 '23 22:09 drackp2m

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

github-actions[bot] avatar Mar 25 '24 00:03 github-actions[bot]

Up!

tonivj5 avatar Mar 25 '24 03:03 tonivj5

Confirming the issue still remains as of version 18.3.2

Running a node CLI-based tool

Brocco avatar May 01 '24 18:05 Brocco