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

remix dev --debug isn't accessible from outside Docker #4216

Closed
frontsideair opened this issue Sep 17, 2022 · 2 comments
Closed

remix dev --debug isn't accessible from outside Docker #4216

frontsideair opened this issue Sep 17, 2022 · 2 comments

Comments

@frontsideair
Copy link
Contributor

What version of Remix are you using?

1.6.5

Steps to Reproduce

  • Start a dev server with remix dev --debug inside a docker container
  • Try to access it (from VSCode or Chrome Inspector) with the printed address

Expected Behavior

The inspector should be attached

Actual Behavior

The inspector doesn't attach

I think it's because the host is 127.0.0.1 by default (and not configurable) which doesn't work well with Docker, see this SO answer. It should either be 0.0.0.0 by default, or be configurable the way Nodejs debugger CLI is, like this: node --inspect=0.0.0.0:9229 main.js

@meglio
Copy link

meglio commented Sep 21, 2022

I can confirm this is a problem.

The issue exists because --debug starts an inspector without specifying any parameters, and thus does not give us any way to specify a different host to bind to:

 

The deafult host is 127.0.0.1, which makes it impossible to connect to the inspector from outside of Docker:

https://nodejs.org/en/docs/guides/debugging-getting-started/#command-line-options

A temporary workaround could be to use e.g. Socat to route debugger traffic accordingly.

The actual solution would be to make --debug in remix a boolean OR string argument, so that it can accept address and/or port to bind to: --debug=host:port. It is currently a boolean argument, so no custom host/port can be specified, and it is not passed through to inspector.open();.

@pcattori
Copy link
Contributor

pcattori commented Jul 5, 2023

The new v2 dev server now let's you specify a custom server command, which means you can use node directly: remix dev -c 'node --debug ./server.js'

Note: You can use binode if you want to pass node flags to remix-serve.

@pcattori pcattori closed this as completed Jul 5, 2023
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

4 participants