-
Notifications
You must be signed in to change notification settings - Fork 26.1k
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
Debugging fix #47083 #47671
Closed
Closed
Debugging fix #47083 #47671
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jarethtan
requested review from
timneutkens,
ijjk,
shuding,
huozhi and
feedthejim
as code owners
March 29, 2023 20:04
1 task
ijjk
reviewed
May 23, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closing in favor of #48019 thanks for the PR though!
ijjk
added a commit
that referenced
this pull request
May 23, 2023
## Bug This fix closes #47083 issue This fix closes #47561 issue This fix closes #48376 issue **Invalid repetition PRs:** #47671 (this PR changing expired code) (This issue still exist on [v13.4.3-canary.1](https://github.com/vercel/next.js/releases/tag/v13.4.3-canary.1) - [x] Related issues linked using `fixes #number` ### What? When running `NODE_OPTIONS='--inspect' next dev`, the render server didn't start with `--inspect`. In some cases, the `--inspect` flag will be passed when `__NEXT_DISABLE_MEMORY_WATCHER` was set. ### Why? Since #47208 revamped some startup processes, the `NODE_OPTIONS` environment parameter is not passed down to the render server worker. ### How? Just add back the original startup process. ![image](https://user-images.githubusercontent.com/14261588/230398898-791e6909-6f4c-493b-937d-058a7b788849.png) link NEXT-1176 --------- Co-authored-by: JJ Kasper <jj@jjsweb.site>
hydRAnger
pushed a commit
to hydRAnger/next.js
that referenced
this pull request
Jun 12, 2023
## Bug This fix closes vercel#47083 issue This fix closes vercel#47561 issue This fix closes vercel#48376 issue **Invalid repetition PRs:** vercel#47671 (this PR changing expired code) (This issue still exist on [v13.4.3-canary.1](https://github.com/vercel/next.js/releases/tag/v13.4.3-canary.1) - [x] Related issues linked using `fixes #number` ### What? When running `NODE_OPTIONS='--inspect' next dev`, the render server didn't start with `--inspect`. In some cases, the `--inspect` flag will be passed when `__NEXT_DISABLE_MEMORY_WATCHER` was set. ### Why? Since vercel#47208 revamped some startup processes, the `NODE_OPTIONS` environment parameter is not passed down to the render server worker. ### How? Just add back the original startup process. ![image](https://user-images.githubusercontent.com/14261588/230398898-791e6909-6f4c-493b-937d-058a7b788849.png) link NEXT-1176 --------- Co-authored-by: JJ Kasper <jj@jjsweb.site>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
This fix closes #47083 issue.
Why?
Debugger crashes when
--inspect=0.0.0.0:9229
was passed.In order to expose a debugger from inside a Docker container, it has to listen on
0.0.0.0
instead of the default127.0.0.1
IP address. To do that, we have to specify an inspect flag format of--inspect=0.0.0.0:9229
. In the code:next.js/packages/next/src/cli/next-dev.ts
Lines 506 to 519 in aca83d2
Passing
NODE_OPTIONS=--inspect=0.0.0.0:9229 next dev
into thedebugPort
function, It expectsdebugPortStr
to be shaped like an integer. But if you use--inspect:0.0.0.0:9229
,debugPortStr
is now0.0.0.0:9229
, thus the parse fails and returns0
.Then not long after, it tries using this
0
port and does+1
on it.next.js/packages/next/src/cli/next-dev.ts
Line 541 in aca83d2
Causing this warning
warn - the --inspect option was detected, the Next.js server should be inspected at port 1
.Then a subsequent error
/usr/bin/node: must be 0 or in range 1024 to 65535
.How?
The recommendation is to create a function
transformInspectFlagForNextAvailablePort()
that returns an entire string input. Four different types of inspect flag inputs are accepted for this function and the actions are as follows:--inspect=0.0.0.0:9229
. function shall accept inspect flag with the port number modified to+1
on the user specified port number (In this case it is9229
). Resulting port will be9230
. Function will return--inspect=0.0.0.0:9230
.--inspect=0.0.0.0
. function shall accept inspect flag with IP address specified. Since port is not specified, a default port number of9229
is allocated and+1
to it. Resulting port will be9230
. Function will return--inspect=0.0.0.0:9230
.--inspect=9229
. function shall accept inspect flag with port specified. Since IP is not specified, a default IP address of127.0.0.1
is allocated and+1
to it. Function will return--inspect=127.0.0.1:9230
.--inspect
. function shall accept inspect flag with port specified. Since IP and Port are not specified, a default IP address of127.0.0.1
and a default port number of9229
are allocated. Default port (9229
) is modified to+1
and resulting port will be9230
. Function will return--inspect=127.0.0.1:9230
.Try out the function in the following Link
Fixes
Returns the correct inspect flag string format to
process.execArgv
when docker IP address0.0.0.0
is included in the inspect flag.Note: I have tried running
pnpm lint
however it fails with an error as followsLint console output
However I am unable to trace the bug and find out what is the linting error. I tried
pnpm lint--fix
and ranpnpm lint
but the problem is still there