Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tonivj5 opened this issue Feb 21, 2023 · 29 comments
Open

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

tonivj5 opened this issue Feb 21, 2023 · 29 comments

Comments

@tonivj5
Copy link

tonivj5 commented Feb 21, 2023

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

@tagplus5
Copy link
Contributor

tagplus5 commented Feb 21, 2023

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

@Dzixxx
Copy link

Dzixxx commented Feb 24, 2023

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

@tagplus5
Copy link
Contributor

@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"
        }
      }
    },

@Dzixxx
Copy link

Dzixxx commented Feb 27, 2023

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 😢

@alljinx
Copy link

alljinx commented Mar 1, 2023

+1 really a pain !

@krzysztofKubiakVizlib
Copy link

Experience of work with Node is terrible right now ;/

@gdraganic
Copy link

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

@slaby93
Copy link

slaby93 commented Mar 16, 2023

Still a issue

@driley-abbvie
Copy link

+1 want this back

@ziacik
Copy link
Contributor

ziacik commented Apr 10, 2023

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.

@tomachianura
Copy link

tomachianura commented Apr 12, 2023

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?

@parzival418
Copy link

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

@nftgeek
Copy link

nftgeek commented May 9, 2023

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

@lukepetrocochino
Copy link

Still not working, so frustrating

@alljinx
Copy link

alljinx commented May 18, 2023

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

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

@drackp2m
Copy link

drackp2m commented Jun 12, 2023

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

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

@goinnovise
Copy link

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.

@drackp2m
Copy link

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.

Copy link

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 github-actions bot added the stale label Mar 25, 2024
@tonivj5
Copy link
Author

tonivj5 commented Mar 25, 2024

Up!

@Brocco
Copy link
Contributor

Brocco commented May 1, 2024

Confirming the issue still remains as of version 18.3.2

Running a node CLI-based tool

@berkoca
Copy link

berkoca commented Jun 5, 2024

Is there any progress on this issue?

@minikdev
Copy link

bump.
have the issue with version 19.0.6

@anh-ocean
Copy link

throw new Error(Could not find ${fileToRun}. Make sure your build succeeded.);

@Brocco
Copy link
Contributor

Brocco commented Aug 26, 2024

Update - I updated my project to v19.6.1 and was able to successfully debug via vs code 🎉🎉🎉

My launch.json config looks like this:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node-terminal",
      "name": "Run npm script",
      "request": "launch",
      "command": "npm run { script name }",
      "cwd": "${workspaceFolder}"
    }
  ]
}

@minikdev
Copy link

minikdev commented Sep 4, 2024

I have 2 apps (node.js and nest.js) and run them by running nx run-many --target=serve --projects=api,transactions --parallel command. How can I add a debugger to both of them?

@adamwdennis
Copy link

see my comment here: #14708 (comment)

Copy link

This issue has been automatically marked as stale because it hasn't had any activity for 6 months.
Many things may have changed within this time. The issue may have already been fixed or it may not be relevant anymore.
If at this point, this is still an issue, please respond with updated information.
It will be closed in 21 days if no further activity occurs.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label Mar 22, 2025
@tonivj5
Copy link
Author

tonivj5 commented Mar 23, 2025

Up!

@github-actions github-actions bot removed the stale label Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests