-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Fix debugger port #60919
Fix debugger port #60919
Conversation
Any news on this ? the issue is several months old... Can you either merge it or provide change requests so we can properly debug next.js application running in docker container ? |
2d0af87
to
0ced190
Compare
@HelmerBarcos nice! regarding the getDebugPort regex pattern. You just may have to extend the regex pattern within the next.js/packages/next/src/server/lib/utils.ts Lines 22 to 23 in 33e8334
...to Edit: I've just updated the regex. |
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
@HelmerBarcos Also please consider the next.js/packages/next/src/cli/next-dev.ts Lines 249 to 250 in f9cd55f
nextjs adds an additional debuggerlistener (default on 9230) which currently does not work because it does not respect the host/ip. You may want to adopt some hints from @antoninhpix comment ( Hopefully this will get fixed soon. Currently, nextjs is broken when running in docker. Thanks! |
What?
This PR is clone of #53683 after Tim's recommendation. See #53683 (comment)
This enables debugging sessions from a remote host. This is helpful while debugging a Next.js application that runs inside a Docker container with following possibilities inside the
package.json
:Bug
This fixes:
Other "fixed" bugs
Why?
It was an attempt to fix the bug, but it didn't work for all the cases.
Keep in mind that the default host will be
127.0.0.1
, and this will be blocked for external hosts trying to attach to the debugger. TheNODE_OPTIONS
should be set toNODE_OPTIONS='--inspect=0.0.0.0:SOME_PORT'
.https://nodejs.org/en/docs/guides/debugging-getting-started#security-implications
How?
By improving the regex used for matching a debug port and adding some conditions to be met.