-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
[NEXT-1179] Chrome dev tools debugging #48767
Comments
In latest version of Next.js we run multiple Node.js processes, so the |
I've just tried this in version 13.4.0 and it still does not allow server side debugging. Prior to version 13.3.x, it (mostly) worked by following the workaround posted by @icyJoseph It can be reproduced quite quickly using the TypeScript Next.js example |
Just wondering if this is being prioritised? It's quite a major impediment to developing production apps with Next.js 13 |
Ran into this issue as well. As mentioned above, the issue is that the debug server is started on the wrong I observed that
When the next server is up and running, |
It appears a fix is being worked on here #48019 |
## Fixing a bug Fixes #50489 Fixes #48767 Fixes #45697 ## What? When running `NODE_OPTIONS='--inspect' next dev` Then go to `http://localhost:3000/` Will display error message `WebSockets request was expected` like the following screenshot ![image](https://github.com/vercel/next.js/assets/14261588/d2f3e520-7cce-40db-be69-99980804cc51) Also the debug port for app and page still not follow by user input When `NODE_OPTIONS='--inspect=8000' next dev` the app debug port still `54151` ![image](https://github.com/vercel/next.js/assets/14261588/e3d25c0e-9d00-4767-94d6-d954776912b2) ## Why? #50248 added a function `getFreePort()` and it used on debug port and HTTP server port So conflict happen between debug and HTTP port Then show up error `WebSockets request was expected` Here are some references about this error: https://stackoverflow.com/questions/49766500/websockets-request-was-expected-error-when-using-inspect-brk-option ## How? 1. `getFreePort()` should only use on HTTP server 2. Added `getDebugPort()` for read the port from user input 3. Assign port to each worker 4. Add accurate info log for each debug port, e.g.: `proxy`,`router`,`app`,`page` When `NODE_OPTIONS='--inspect' next dev` ![image](https://github.com/vercel/next.js/assets/14261588/2260fdff-13fe-435a-9812-984315c0ea2e) When `NODE_OPTIONS='--inspect=8000' next dev` ![image](https://github.com/vercel/next.js/assets/14261588/de6e2f2d-9216-481f-b6db-7c5132e97b6f) Also fix VSCode debugger It is worth noting that We can't hit the breakpoint on the first execution because the file does not exist there yet or was not compiled In most cases, the breakpoint can only be triggered normally during the second execution ![image](https://github.com/vercel/next.js/assets/14261588/dccded50-46c5-4b6d-beb7-ff0e5324327a) Closes NEXT-1179 Closes NEXT-517 Co-authored-by: Shu Ding <3676859+shuding@users.noreply.github.com>
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 Binaries: Node: 16.19.0 npm: 8.19.3 Yarn: N/A pnpm: 8.3.1 Relevant packages: next: 13.3.1 eslint-config-next: 13.3.1 react: 18.2.0 react-dom: 18.2.0
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue
N/A
To Reproduce
Add a
debugger
line after running the app via"NODE_OPTIONS='--inspect' next dev
Describe the Bug
Happened after upgrading from next 12 to 13:
Expected Behavior
Chrome dev tools should stop execution in the debugger line
Which browser are you using? (if relevant)
Chrome 112.0.5615.137
How are you deploying your application? (if relevant)
No response
NEXT-1179
The text was updated successfully, but these errors were encountered: