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

--inspect-brk=0.0.0.0 does not set host successfully #26379

Closed
narthur opened this issue Aug 11, 2020 · 3 comments
Closed

--inspect-brk=0.0.0.0 does not set host successfully #26379

narthur opened this issue Aug 11, 2020 · 3 comments
Assignees
Labels
topic: cli Related to the Gatsby CLI type: bug An issue or pull request relating to a bug in Gatsby

Comments

@narthur
Copy link

narthur commented Aug 11, 2020

Description

Using --inspect-brk=0.0.0.0 with gatsby develop does not set debugger to listen on 0.0.0.0 as Node's docs indicate it does when used on node directly.

Steps to reproduce

  1. node --no-lazy node_modules/.bin/gatsby develop --inspect-brk=0.0.0.0
  2. See in logs: Debugger listening on ws://127.0.0.1:9229/43d0600c-22dc-40e9-98f6-f27004b6d353

Expected result

Debugger should listen on 0.0.0.0, not 127.0.0.1

Actual result

Debugger listens on 127.0.0.1 instead of 0.0.0.0

Environment

  System:
    OS: Linux 4.19 Debian GNU/Linux 9 (stretch) 9 (stretch)
    CPU: (6) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Shell: 4.4.12 - /bin/bash
  Binaries:
    Node: 14.3.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.5 - /usr/local/bin/npm
  Languages:
    Python: 2.7.13 - /usr/bin/python
  npmPackages:
    gatsby: ^2.23.12 => 2.24.24
    gatsby-image: ^2.4.9 => 2.4.14
    gatsby-plugin-manifest: ^2.4.18 => 2.4.21
    gatsby-plugin-offline: ^3.2.13 => 3.2.21
    gatsby-plugin-react-helmet: ^3.3.6 => 3.3.10
    gatsby-plugin-sass: ^2.3.12 => 2.3.12
    gatsby-plugin-sharp: ^2.6.14 => 2.6.24
    gatsby-source-filesystem: ^2.3.14 => 2.3.23
    gatsby-source-graphql: ^2.6.1 => 2.6.2
    gatsby-transformer-sharp: ^2.5.7 => 2.5.12
  npmGlobalPackages:
    gatsby-cli: 2.12.59
@narthur narthur added the type: bug An issue or pull request relating to a bug in Gatsby label Aug 11, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Aug 11, 2020
@freiksenet freiksenet added topic: cli Related to the Gatsby CLI and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Aug 12, 2020
@pieh
Copy link
Contributor

pieh commented Aug 13, 2020

Hi @narthur. Right now the gatsby develops --inspect(-brk) switches only handle ports and not the host part:

const openDebuggerPort = (debugInfo: IDebugInfo): void => {
if (debugInfo.break) {
inspector.open(debugInfo.port, undefined, true)
// eslint-disable-next-line no-debugger
debugger
} else {
inspector.open(debugInfo.port)
}
}

(per nodejs docs https://nodejs.org/api/inspector.html#inspector_inspector_open_port_host_wait - inspector.open 2nd param is the host, which we just don't set right now.

For reference those are the changes that introduced those cli switches - #24693 - to support host part we would need to adjust cli flags (yargs configuration) to be strings and then do some handling to split passed strings into host + port, so syntaxes like:

  • --inspect-brk=0.0.0.0 - result in setting host and using default port
  • --inspect-brk=0.0.0.0:9230 - result in setting host and port
  • --inspect-brk=9230 - result in setting port and using default host

@narthur
Copy link
Author

narthur commented Aug 13, 2020

@pieh Thanks for the info! Are you open to a PR on this?

@LekoArts
Copy link
Contributor

Hi!

I'm closing this as a stale issue as in the meantime Gatsby 4 and related packages were released. You can check our Framework Version Support Page to see which versions currently receive active support.

Please try the mentioned issue on the latest version (using the next tag) and if you still see this problem, open a new bug report. It must include a minimal reproduction.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: cli Related to the Gatsby CLI type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

5 participants