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

local mode does not come up when HOST is not resolvable #18

Open
davepacheco opened this issue Oct 4, 2023 · 3 comments
Open

local mode does not come up when HOST is not resolvable #18

davepacheco opened this issue Oct 4, 2023 · 3 comments

Comments

@davepacheco
Copy link

On my system, HOST=zathras (in the environment). But zathras is not resolvable in DNS. If I run this, it reports this error and then sits there, not having started listening on port 3000:

$ LOCAL_RFD_REPO=... npm run dev

> dev
> remix dev


 💿  remix dev

 info  building...
 warn  esm-only package: @asciidoctor/core
┃ @asciidoctor/core is possibly an ESM-only package.
┃ To bundle it with your server, include it in `serverDependenciesToBundle`
┃ -> https://remix.run/docs/en/main/file-conventions/remix-config#serverdependenciestobundle
┗
 info  built (10.5s)
Error: getaddrinfo ENOTFOUND zathras
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)

I was confused about whether this problem was fatal or not. It seems like it basically is but the program doesn't exit. I worked around it by setting HOST=zathras.local.

@david-crespo
Copy link
Contributor

david-crespo commented Oct 4, 2023

Cool. Seems like this might be fixed in Remix v2, which I am in the process of upgrading to in oxidecomputer/rfd-site-old#238.

v1.19

https://github.com/remix-run/remix/blob/21d22901fdc3e50650c73825fbea171cf6e93ad0/packages/remix-dev/cli/commands.ts#L513-L516

v2

It might always use localhost in dev mode:

https://github.com/remix-run/remix/blob/a20ae7fb0727212ac52bdc687513c61851ac4014/packages/remix-dev/cli/commands.ts#L344-L346

@david-crespo
Copy link
Contributor

david-crespo commented Oct 4, 2023

I checked and v2 does not fix this, it does the same thing.

~/oxide/rfd-site $ HOST=abc LOCAL_RFD_REPO=~/oxide/rfd npm run dev

> dev
> remix dev


 💿  remix dev

 info  building...
 info  built (4.3s)

Error: getaddrinfo ENOTFOUND abc
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26)

What do you think it should be doing instead? Do you think local dev should always use localhost regardless of the value of HOST? If so, here's the stupid fix we could go with (I don't really see an issue with it):

-    "dev": "remix dev",
+    "dev": "HOST=localhost remix dev",
~/oxide/rfd-site $ HOST=abc LOCAL_RFD_REPO=~/oxide/rfd npm run dev

> dev
> HOST=localhost remix dev


 💿  remix dev

 info  building...
 info  built (4s)

[remix-serve] http://localhost:3000 (http://localhost:3000)

@davepacheco
Copy link
Author

I checked and v2 does not fix this, it does the same thing.

~/oxide/rfd-site $ HOST=abc LOCAL_RFD_REPO=~/oxide/rfd npm run dev

> dev
> remix dev


 💿  remix dev

 info  building...
 info  built (4.3s)

Error: getaddrinfo ENOTFOUND abc
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26)

What do you think it should be doing instead? Do you think local dev should always use localhost regardless of the value of HOST? If so, here's the stupid fix we could go with (I don't really see an issue with it):

-    "dev": "remix dev",
+    "dev": "HOST=localhost remix dev",

That seems fine. I don't know enough about Remix to have much opinion. A lot of stuff assumes that a system's hostname is resolvable in DNS, but that's generally not a great assumption. Usually if I want something to listen on anything other than localhost, I want to tell it exactly what. In that sense, I'd rather it didn't look at HOST at all, but 🤷 maybe for most users that's what they want.

I would also be happy with an error message that said that it failed to come up because of this (and ideally where it got the hostname from) and then exiting instead of just hanging. The real reason this was annoying was that I spent time trying to guess if it came up anyway (I noticed it did open port 3001 and tried that) and also guessing where it got zathras from. But it seems like fixing these issues is probably harder than just telling it to use localhost.

Thanks for looking at this!

@benjaminleonard benjaminleonard transferred this issue from another repository Mar 11, 2024
@david-crespo david-crespo mentioned this issue Mar 11, 2024
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

2 participants