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: unable to find network to expose when exposing to network with Node 18.1+ #3598

Closed
1 task done
arimgibson opened this issue Jun 15, 2022 · 9 comments · Fixed by #3599
Closed
1 task done

Comments

@arimgibson
Copy link
Contributor

arimgibson commented Jun 15, 2022

What version of astro are you using?

1.0.0-beta.46

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

pnpm

What operating system are you using?

Windows

Describe the Bug

In Node 18.1, a change to the return value of os.networkInterfaces() is made, causing Astro to be unable to find a network to host the Astro dev or preview servers on (specific error is unable to find network to expose). This is because when Astro is checking for valid network interfaces, it looks an interface with family: IPv4, and Node 18.1 uses a simple integer value of family: 4.

This change can be observed in the official Node documentation for the Node 16 LTS vs the Node 18 LTS. Look under the return object properties...

Node 18 os.networkInterfaces()
Node 16 os.networkInterfaces()

Image example from Node 16
image

I'll handle the PR; it's a pretty easy one...

Link to Minimal Reproducible Example

N/A

Participation

  • I am willing to submit a pull request for this issue.
@arimgibson arimgibson changed the title 🐛 BUG: 🐛 BUG: unable to find network to expose when exposing to network with Node 18 Jun 15, 2022
@arimgibson arimgibson changed the title 🐛 BUG: unable to find network to expose when exposing to network with Node 18 🐛 BUG: unable to find network to expose when exposing to network with Node 18.1+ Jun 15, 2022
@arimgibson
Copy link
Contributor Author

Correcting my bug report to specify that this breaking change is introduced in Node v18.1.0, not Node v18.0.0 like I initially assumed

@chitowncrispy
Copy link

@arimgibson I am running node version 18.6.0 and I am not able to expose it to the network. It looks like your fix probably works for node versions 18.1.0 to 18.3.0. I am guessing version 18.4.0 nullifies your changes since they seem to have reverted the family property back to a string like it was in Node 16.

For reference:

Node 18.1.0 working:
Screen Shot 2022-07-23 at 11 56 49 AM

Node 18.6.0 not working:
Screen Shot 2022-07-23 at 12 00 16 PM

@arimgibson
Copy link
Contributor Author

@chitowncrispy really good catch! That's frustrating; I'll go PR an amended version now. Thanks for finding that and letting me know!

@chitowncrispy
Copy link

@arimgibson No problem. Just as an FYI it looks like the logic you implemented should apply for Node version 18.0.0 as well since that is when Node first introduced the family property as a number.

@arimgibson
Copy link
Contributor Author

Ugh, can't believe I missed that too @chitowncrispy! Updated PR submitted though, thanks again!

@anurag-roy
Copy link

anurag-roy commented Oct 1, 2022

Facing the same issue 🙁

Node: v18.10.0
Astro: v1.2.1
Package Manager: pnpm
SSR Adapters: none
OS: macOS Monterey

Screenshot 2022-10-02 at 12 43 05 AM

@arimgibson
Copy link
Contributor Author

No way, did they change it again 😹 thanks for reporting @anurag-roy , taking a look

@arimgibson
Copy link
Contributor Author

arimgibson commented Oct 1, 2022

Hmmm, I was unable to replicate this @anurag-roy , though I am on Windows. I noticed that your version of Astro seems to be out of date, current release is v1.4.2. Are you able to upgrade Astro and see if you're still encountering this bug?

If the bug still occurs, it might be something macOS-specific which I would not be able to debug as I don't have access to a Mac.

Edit: I downgraded my Astro to the version you're on (v1.2.1) and encountered the same issue. This is likely fixed by updating to the newest version of Astro.

@anurag-roy
Copy link

@arimgibson Upgrading to v1.4.2 solved it! Thanks a lot for looking into it!

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

Successfully merging a pull request may close this issue.

3 participants