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

bug(dev host binding @next.321): Unable to bind to 0.0.0.0 #4745

Closed
ryanrussell opened this issue Apr 26, 2022 · 2 comments
Closed

bug(dev host binding @next.321): Unable to bind to 0.0.0.0 #4745

ryanrussell opened this issue Apr 26, 2022 · 2 comments

Comments

@ryanrussell
Copy link

ryanrussell commented Apr 26, 2022

Describe the bug

I am running SvelteKit in a docker container.

After upgrading to @next.321, I am unable to bind to 0.0.0.0 using npm run dev , which prevents access to SvelteKit inside the container

There appears to be a breaking change around npm run preview and host #4729 on 321. Perhaps there are some side effects to dev mode binding to '0.0.0.0' or the best practices have changed?

#4729

SvelteKit has been working with npm run dev --host to bind to 0.0.0.0 since version ~100.

Reproduction

Attempt 1:

package.json

"scripts": {
    "dev": "svelte-kit dev"
    ...
}
npm run dev -- --host 0.0.0.0

> [email protected] dev
> svelte-kit dev "--host" "0.0.0.0"


  SvelteKit v1.0.0-next.321

  local:   http://localhost:3000
  network: http://192.168.1.159:3000

  Note that all files in the following directories will be accessible to anyone on your network: src/lib, src/routes, .svelte-kit, src, node_modules
  network: http://172.17.0.1:3000

  Note that all files in the following directories will be accessible to anyone on your network: src/lib, src/routes, .svelte-kit, src, node_modules
  network: http://172.22.0.1:3000

  Note that all files in the following directories will be accessible to anyone on your network: src/lib, src/routes, .svelte-kit, src, node_modules

Attempt 2:

package.json

"scripts": {
    "dev": "svelte-kit dev --host 0.0.0.0",
    ...
}
npm run dev

> [email protected] dev
> svelte-kit dev --host 0.0.0.0


  SvelteKit v1.0.0-next.321

  local:   http://localhost:3000
  network: http://192.168.1.159:3000

  Note that all files in the following directories will be accessible to anyone on your network: src/lib, src/routes, .svelte-kit, src, node_modules
  network: http://172.17.0.1:3000

  Note that all files in the following directories will be accessible to anyone on your network: src/lib, src/routes, .svelte-kit, src, node_modules
  network: http://172.22.0.1:3000

  Note that all files in the following directories will be accessible to anyone on your network: src/lib, src/routes, .svelte-kit, src, node_modules

Notice the slightly different rendering of

# Attempt 1 stdout
> svelte-kit dev "--host" "0.0.0.0"
...

# Attempt 2 stdout
> svelte-kit dev --host 0.0.0.0

Logs

In Reproduction.

System Info

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.4 LTS
Release:	20.04
Codename:	focal

node --version
v14.17.0

npm --version
8.3.2

Severity

serious, but I can work around it

Additional Information

This may be isolated to the dev mode

node build/index.js

Still seems to work and bind to 0.0.0.0 from within docker.

@mrkishi
Copy link
Member

mrkishi commented Apr 26, 2022

As discussed in Discord, this is likely an issue with their Docker network configuration since the bindings appeared to be correct when passing --host, --host 0.0.0.0, and a missing --host (as seen on the screenshots on the Discord thread).

@ryanrussell will attempt to get to the bottom of it and provide a minimal reproduction if an issue is found in SvelteKit.

@mrkishi mrkishi closed this as completed Apr 26, 2022
@moritzebeling
Copy link

For me npm run dev --host doesn't work,
but when I add this new command to package.json it does:
"dev-host": "svelte-kit dev --host 0.0.0.0",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants