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

Starting multiple apps in dev mode uses same server (127.0.0.1:1430). #6186

Closed
prabhugopal opened this issue Feb 2, 2023 · 2 comments
Closed
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@prabhugopal
Copy link

prabhugopal commented Feb 2, 2023

Describe the bug

Hi, I am just starting with Tauri.. I am having an issue with multiple apps, when i am running multiple apps in dev mode, all the apps are sharing the same ui, instead of its own ui.. What i noticed was all the apps frontend communicates to the same server, which is nothing but the first server started while running the first app.. Also the other apps, which are started after first app failing to start app server with following error..
error binding to 127.0.0.1:1430..
looks like tauri always uses a static server config..

Is there anyway we can set the server host & port while running cargo tauri dev
Something like below should help
cargo tauri dev --host <host-ip/name> --port <port-no>

Reproduction

  1. Create 2 or more tauri apps using cargo create-tauri-app
  2. Go ahead & update one of the apps' index.html so that it is now same from the other ones.
  3. Now start the apps one by one, in dev mode cargo tauri dev.

We will always see the same ui rendered for all the apps, also check console for the below error for all the apps started after first app.

error binding to 127.0.0.1:1430..

Since the port is already bind to first app server, starting from 2nd app the servers failed to start and clients start rendering the ui content from first app.

Expected behavior

Expect to see the ui specific to the app, also either server should start with different port instead of static one or we should have option of starting the server with different port as below.

cargo tauri dev --host <host-ip/name> --port <port-no>

Platform and versions

Environment
› OS: Mac OS 13.1.0 X64
› Node.js: 16.18.0
› npm: 8.19.2
› pnpm: Not installed!
› yarn: Not installed!
› rustup: 1.25.2
› rustc: 1.67.0
› cargo: 1.67.0
› Rust toolchain: stable-aarch64-apple-darwin

Packages
WARNING: no lock files found, defaulting to npm
› @tauri-apps/cli [NPM]: 1.2.3
› @tauri-apps/api [NPM]: Not installed!
› tauri [RUST]: 1.2.4,
› tauri-build [RUST]: 1.2.1,
› tao [RUST]: 0.15.8,
› wry [RUST]: 0.23.4,

App
› build-type: bundle
› CSP: unset
› distDir: ../src
› devPath: ../src
package.json not found

App directory structure
├─ src-tauri
├─ .vscode
└─ src

Stack trace

thread '<unnamed>' panicked at 'error binding to 127.0.0.1:1430: error creating server listener: Address already in use (os error 48)', /Users/prabhugopal/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.14.23/src/server/server.rs:79:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
        Info Watching /Users/prabhugopal/Learning/tauri/hello-next/src-tauri for changes...
   Compiling hello-next v0.0.0 (/Users/prabhugopal/Learning/tauri/hello-next/src-tauri)
    Finished dev [unoptimized + debuginfo] target(s) in 1.24s

Additional context

No response

@prabhugopal prabhugopal added status: needs triage This issue needs to triage, applied to new issues type: bug labels Feb 2, 2023
@amrbashir
Copy link
Member

By default create-tauri-app creates a template that uses port 1420, if you want to develop multiple apps at the same time then you need to modify the generated template to use another port. This could be done by changing vite.config.js (or any other config file depending on the template you chose) and also change the port in src-tauri/tauri.conf.json.

If you still want to pass the url and port using the CLI, you can do:

cargo tauri dev --config '{"build": { "devPath": "http://localhost:1421"}}'

@amrbashir amrbashir closed this as not planned Won't fix, can't repro, duplicate, stale Feb 7, 2023
@FabianLars
Copy link
Member

@amrbashir The way i understood it on Discord is that this is about tauri's own dev server, if devPath points to static files. It always uses the SERVER_URL constant its url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

3 participants