Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.5k
fix: take the first network found instead of the last one#5411
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…res the same behavior as 5.0.4
linux-foundation-easyclabot commentedJan 28, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The committers listed above are authorized under a signed CLA. |
@mahdikhashan and@alexander-akait you worked on#5255 what do you think of the change? |
@vincentfretin hm, I think it is a breaking change too, in such case I recommend to provide a value for host... We can't detect a right value in such situation |
On Ubuntu it seems I always have loopback, ethernet, wifi and docker bridge in this order. constos=require("os");os.networkInterfaces() In the previous code it also returned the first matching network address What order do you have in other OSes you tested? And why don't you have the issue? Maybe you don't have docker on your machine? |
I used a mac - a recent one with silicon chip. |
@mahdikhashan on macOS what do you have with |
I don't have access to my code setup now, if I remember correctly I had multiple networks - I remember in my first changes, related to this current issue - I had selected the first interface. |
In#5255 the code was taking the last one: lethost;Object.values(os.networkInterfaces())....forEach((network)=>{host=network.address;if(host.includes(":")){host=`[${host}]`;}});// host is the last one and in the latest commit with changes made by@alexander-akait it's now lethost;constnetworks=Object.values(os.networkInterfaces())...for(constnetworkofnetworks){host=network.address;if(host.includes(":")){host=`[${host}]`;}}// host is the last one both code are equivalent and take the last one. In default-gateway, it returned the first one: |
It would be interesting to know where Node.js takes order for |
https://github.com/nodejs/node/blob/a08129cb0d8ff1df3ce45c3910cae1fc72aaf080/lib/os.js#L271 getifaddrs doesn't mention any order, so yeah it seems to be an undefined behavior. If I remove host key in my webpack.config.js devServer config that's another issue, but it listens correctly on 192.168.1.15 I switched now from to It shows: From a developer experience perspective, it would be better imo if it showed this: similar to how http-server does it. That's really what my issue it about, be able to click on the address I want without knowing in advance what is my local ip. |
Can you provide reproducible example, because this should never happen |
I had this config in my file devServer.options.host was undefined here. |
You need to take this options from real Anyway does your dev server work using Only thing that we can improve it is output, we don't want to change logic of getting IPs, because it can break logic for other developers |
|
PR welcome |
dmarcos commentedFeb 10, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I have the same issue on My Macbook Air M1. Before, the IP showed in console when running the server matched my local IP. Now it's showing the IP of a different interface (en0 is my local IP and server shows en5 as shown by ifconfig command). My local IP is also the first one in the list as shown by@vincentfretin when logging |
@alexander-akait I'm curious if we revert back to using the first interface, you said it would be a breaking change. Do you currently use a system where taking the first interface would chose the wrong interface for you? |
@vincentfretin I'm not sure about this because when testing on one of the computers I encountered the opposite problem, where the choice of the first interface was incorrect, I can't judge how common this is, because earlier we had a separate package that also checked the functionality, now as you can see the logic is a little different, I don't mind making changes, but I wouldn't want after the fix and the new release I to receive feedback where I would have to revert and raise the issue again
Ok let's try your solution to the problem, hopefully we won't break it for many users |
I've run the tests, let's see how they go. |
codecovbot commentedFeb 10, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## master #5411 +/- ##===========================================- Coverage 90.29% 76.42% -13.87%=========================================== Files 15 13 -2 Lines 1577 1977 +400 Branches 601 723 +122 ===========================================+ Hits 1424 1511 +87- Misses 140 403 +263- Partials 13 63 +50 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
It seems the new test passed. |
Yeah, I just don’t understand why coverage is broken, we need to resolve it before merge, maybe testes are not executing after new tests… |
ffd0b86 intowebpack:masterUh oh!
There was an error while loading.Please reload this page.
Thanks, release will be soon |
…ne (#457)<!-- Thank you for submitting a pull request!We appreciate the time and effort you have invested in making thesechanges. Please ensure that you provide enough information to allowothers to review your pull request.Upon submission, your pull request will be automatically assigned withreviewers.If you want to learn more about contributing to this project, pleasevisit:https://github.com/lynx-family/lynx-stack/blob/main/CONTRIBUTING.md.-->## Summary<!-- Can you explain the reasoning behind implementing this change? Whatproblem or issue does this pull request resolve? -->Following up to#91, portwebpack/webpack-dev-server#5411<!-- It would be helpful if you could provide any relevant context, suchas GitHub issues or related discussions. -->## Checklist<!--- Check and mark with an "x" -->- [x] Tests updated (or not required).- [ ] Documentation updated (or **not required**).
This PR was opened by the [Changesetsrelease](https://github.com/changesets/action) GitHub action. Whenyou're ready to do a release, you can merge this and the packages willbe published to npm automatically. If you're not ready to do a releaseyet, that's fine, whenever you add more changesets to main, this PR willbe updated.# Releases## @lynx-js/rspeedy@0.9.0### Minor Changes- Bundle Rspeedy with Rslib for faster start-up times.([#395](#395))This would be a **BREAKING CHANGE** for using [global version ofRspeedy](https://lynxjs.org/rspeedy/cli#using-the-global-rspeedy-version).Please ensure that you update your globally installed version ofRspeedy: ```bash npm install --global @lynx-js/rspeedy@latest ```- Bump Rsbuild v1.3.2 with Rspack v1.3.1([#446](#446))- **BREAKING CHANGE**: Added explicit TypeScript peer dependencyrequirement of 5.1.6 - 5.8.x.([#480](#480))This formalizes the existing TypeScript version requirement in`peerDependencies` (marked as optional since it is only needed forTypeScript configurations). The actual required TypeScript version hasnot changed.Note: This may cause installation to fail if you have strict peerdependency checks enabled.Node.js v22.7+ users can bypass TypeScript installation using`--experimental-transform-types` or `--experimental-strip-types` flags.Node.js v23.6+ users don't need any flags. See [Node.js -TypeScript](https://nodejs.org/api/typescript.html) for details.### Patch Changes- Support cli flag `--base` to specify the base path of the server.([#387](#387))- Support cli option `--environment` to specify the name of environmentto build ([#462](#462))- Select the most appropriate network interface.([#457](#457))This is a port of[webpack/webpack-dev-server#5411](webpack/webpack-dev-server#5411).- Support Node.js v23.6+ native TypeScript.([#481](#481))See [Node.js - TypeScript](https://nodejs.org/api/typescript.html) formore details.- Support cli option `--env-mode` to specify the env mode to load the`.env.[mode]` file.([#453](#453))- Support `dev.hmr` and `dev.liveReload`.([#458](#458))- Updated dependencies\[[`df63722`](df63722),[`df63722`](df63722)]: - @lynx-js/chunk-loading-webpack-plugin@0.2.0## @lynx-js/chunk-loading-webpack-plugin@0.2.0### Minor Changes- **BREAKING CHANGE**: Requires `@rspack/core` v1.3.0.([#400](#400))- **BREAKING CHANGE**: Remove the deprecated `ChunkLoadingRspackPlugin`,use `ChunkLoadingWebpackPlugin` with `output.chunkLoading: 'lynx'`instead. ([#400](#400)) ```jsimport { ChunkLoadingWebpackPlugin } from"@lynx-js/chunk-loading-webpack-plugin"; export default { output: { chunkLoading: "lynx", }, plugins: [new ChunkLoadingWebpackPlugin()], }; ```## @lynx-js/react@0.106.3### Patch Changes- Do some global var initialize in hydrate, which fixes error like`cannot read property '-21' of undefined` and some style issue.([#461](#461))- fix: ensure ref lifecycle events run after firstScreen in thebackground thread([#434](#434))This patch fixes an issue where ref lifecycle events were running beforefirstScreen events in the background thread async render mode, whichcould cause refs to be undefined when components try to access them.## @lynx-js/qrcode-rsbuild-plugin@0.3.5### Patch Changes- Build with Rslib([#396](#396))## @lynx-js/react-rsbuild-plugin@0.9.5### Patch Changes- fix: add enableCSSInvalidation for encodeCSS of css HMR, this will fixpseudo-class (such as `:active`) not working in HMR.([#435](#435))- Disable `module.generator.json.JSONParse` option as it increases thebundle size of `main-thread.js`. For more detail, please see this[issue](webpack/webpack#19319).([#402](#402))- Updated dependencies\[[`3e7988f`](3e7988f),[`7243242`](7243242)]: - @lynx-js/css-extract-webpack-plugin@0.5.3 - @lynx-js/template-webpack-plugin@0.6.8 - @lynx-js/react-alias-rsbuild-plugin@0.9.5 - @lynx-js/react-refresh-webpack-plugin@0.3.2 - @lynx-js/react-webpack-plugin@0.6.10 - @lynx-js/web-webpack-plugin@0.6.3## @lynx-js/web-constants@0.10.1### Patch Changes- feat: onNapiModulesCall function add new param: `dispatchNapiModules`,napiModulesMap val add new param: `handleDispatch`.([#414](#414))Now you can use them to actively communicate to napiModules (backgroundthread) in onNapiModulesCall (ui thread).- Updated dependencies \[]: - @lynx-js/web-worker-rpc@0.10.1## @lynx-js/web-core@0.10.1### Patch Changes- docs: fix documents about lynx-view's properties([#412](#412)) Attributes should be hyphen-name: 'init-data', 'global-props'. now all properties has corresponding attributes.- feat: onNapiModulesCall function add new param: `dispatchNapiModules`,napiModulesMap val add new param: `handleDispatch`.([#414](#414))Now you can use them to actively communicate to napiModules (backgroundthread) in onNapiModulesCall (ui thread).- Updated dependencies\[[`1af3b60`](1af3b60)]: - @lynx-js/web-constants@0.10.1 - @lynx-js/web-worker-runtime@0.10.1 - @lynx-js/web-worker-rpc@0.10.1## @lynx-js/web-elements@0.5.3### Patch Changes- feat: add `layoutchange` event support for x-view and x-text([#408](#408))## @lynx-js/web-mainthread-apis@0.10.1### Patch Changes- Updated dependencies\[[`1af3b60`](1af3b60)]: - @lynx-js/web-constants@0.10.1## @lynx-js/web-worker-runtime@0.10.1### Patch Changes- feat: onNapiModulesCall function add new param: `dispatchNapiModules`,napiModulesMap val add new param: `handleDispatch`.([#414](#414))Now you can use them to actively communicate to napiModules (backgroundthread) in onNapiModulesCall (ui thread).- Updated dependencies\[[`1af3b60`](1af3b60)]: - @lynx-js/web-constants@0.10.1 - @lynx-js/web-mainthread-apis@0.10.1 - @lynx-js/web-worker-rpc@0.10.1## @lynx-js/css-extract-webpack-plugin@0.5.3### Patch Changes- Fix CSS HMR not working with nested entry name.([#456](#456))- fix: add enableCSSInvalidation for encodeCSS of css HMR, this will fixpseudo-class (such as `:active`) not working in HMR.([#435](#435))## @lynx-js/template-webpack-plugin@0.6.8### Patch Changes- fix: add enableCSSInvalidation for encodeCSS of css HMR, this will fixpseudo-class (such as `:active`) not working in HMR.([#435](#435))## create-rspeedy@0.9.0## @lynx-js/react-alias-rsbuild-plugin@0.9.5## upgrade-rspeedy@0.9.0## @lynx-js/web-worker-rpc@0.10.1Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Take the first network found instead of the last one that may be the docker bridge. This restores the same behavior as 5.0.4, this fixes a regression introduced in 5.1.0 where the default-gateway dependency was dropped.
For Bugs and Features; did you add new tests?
I tried to include a test and run it with
npm run test:only test/cli/hot-option.test.jsbut I can't make it run on my machine, it's just blocking at
RUNS test/cli/hot-option.test.js
no idea why.
I also have lots of failing tests and other files blocking like this when I'm testing on my machine.
Hopefully the CI may execute the test, finger crossed.
Motivation / Use-Case
On version 5.0.4 with
--host local-ipon Ubuntu, it returnedhttps://192.168.1.15:8080On 5.1.0 and 5.2.0 it returns
https://172.17.0.1:8080that is the docker bridge, not so useful.The new code introduced in#5255 was taking the last network of the networks array.
The change in this PR take the first one in networks array.
Breaking Changes
No breaking change, this fixes a regression introduced in 5.1.0 where the default-gateway dependency was dropped.
Additional Info