Skip to content

[bug] bun run tauri ios dev cannot connect to the host machine #13637

Open
@tdelabro

Description

@tdelabro

Describe the bug

I start from the default project, just adding the logging plugin.
Run bun run tauri ios dev , select iPhone 16 (iOS 18.5) and get:

2025-06-19 18:27:28.206547-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] pooling idle connection for ("http", localhost:1420)
2025-06-19 18:27:28.206594-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] pool closed, canceling idle interval
2025-06-19 18:27:28.206644-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] checkout waiting for idle connection: ("http", localhost:1420)
2025-06-19 18:27:28.206734-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [reqwest::connect] starting new connection: http://localhost:1420/
2025-06-19 18:27:28.206769-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::connect::http] Http::connect; scheme=Some("http"), host=Some("localhost"), port=Some(Port(1420))
2025-06-19 18:27:28.206835-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::connect::http] connecting to [::1]:1420
2025-06-19 18:27:28.206884-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::connect::http] connected to [::1]:1420
2025-06-19 18:27:28.206951-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::client] http1 handshake complete, spawning background dispatcher task
2025-06-19 18:27:28.207000-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::client] waiting for connection to be ready
2025-06-19 18:27:28.207046-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::client] connection is ready
2025-06-19 18:27:28.207087-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] checkout dropped for ("http", localhost:1420)
2025-06-19 18:27:28.207134-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] put; add idle connection for ("http", localhost:1420)
2025-06-19 18:27:28.207195-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] pooling idle connection for ("http", localhost:1420)
2025-06-19 18:27:28.207256-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] pool closed, canceling idle interval
2025-06-19 18:27:28.207326-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] checkout waiting for idle connection: ("http", localhost:1420)
2025-06-19 18:27:28.207390-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [reqwest::connect] starting new connection: http://localhost:1420/
2025-06-19 18:27:28.207425-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::connect::http] Http::connect; scheme=Some("http"), host=Some("localhost"), port=Some(Port(1420))
2025-06-19 18:27:28.207531-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::connect::http] connecting to [::1]:1420
2025-06-19 18:27:28.207544-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::connect::http] connected to [::1]:1420
2025-06-19 18:27:28.207585-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::client] http1 handshake complete, spawning background dispatcher task
2025-06-19 18:27:28.207631-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::client] waiting for connection to be ready
2025-06-19 18:27:28.207680-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::client] connection is ready
2025-06-19 18:27:28.207732-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] checkout dropped for ("http", localhost:1420)
2025-06-19 18:27:28.207784-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] put; add idle connection for ("http", localhost:1420)
2025-06-19 18:27:28.207826-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] pooling idle connection for ("http", localhost:1420)
2025-06-19 18:27:28.207871-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] pool closed, canceling idle interval
2025-06-19 18:27:28.207910-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] checkout waiting for idle connection: ("http", localhost:1420)
2025-06-19 18:27:28.207957-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [reqwest::connect] starting new connection: http://localhost:1420/
2025-06-19 18:27:28.208001-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::connect::http] Http::connect; scheme=Some("http"), host=Some("localhost"), port=Some(Port(1420))
2025-06-19 18:27:28.208067-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::connect::http] connecting to [::1]:1420
2025-06-19 18:27:28.208095-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::connect::http] connected to [::1]:1420
2025-06-19 18:27:28.208137-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::client] http1 handshake complete, spawning background dispatcher task
2025-06-19 18:27:28.208192-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::client] waiting for connection to be ready
2025-06-19 18:27:28.208236-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::client] connection is ready
2025-06-19 18:27:28.208296-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] checkout dropped for ("http", localhost:1420)
2025-06-19 18:27:28.208334-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] put; add idle connection for ("http", localhost:1420)
2025-06-19 18:27:28.208373-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] pooling idle connection for ("http", localhost:1420)
2025-06-19 18:27:28.208422-0300 0x1aa1d6   Default     0x0                  60085  0    trying: [com.trying.app:app] [hyper_util::client::legacy::pool] pool closed, canceling idle interval

Repeating again and again.

/src-tauri/capabilities/default.json

{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default",
  "description": "Capability for the main window",
  "windows": [
    "main"
  ],
  "permissions": [
    "log:default",
    "opener:default",
    "core:default"
  ]
}

Cargo.toml

[package]
name = "trying"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
# The `_lib` suffix may seem redundant but it is necessary
# to make the lib name unique and wouldn't conflict with the bin name.
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
name = "trying_lib"
crate-type = ["staticlib", "cdylib", "rlib"]

[build-dependencies]
tauri-build = { version = "2", features = [] }

[dependencies]
tauri = { version = "2", features = [] }
tauri-plugin-opener = "2"
tauri-plugin-log = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"

package.json

{
  "name": "trying",
  "version": "0.1.0",
  "description": "",
  "type": "module",
  "scripts": {
    "dev": "vite dev",
    "build": "vite build",
    "preview": "vite preview",
    "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
    "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
    "tauri": "tauri"
  },
  "license": "MIT",
  "dependencies": {
    "@tauri-apps/api": "^2",
    "@tauri-apps/plugin-opener": "^2"
  },
  "devDependencies": {
    "@sveltejs/adapter-static": "^3.0.6",
    "@sveltejs/kit": "^2.9.0",
    "@sveltejs/vite-plugin-svelte": "^5.0.0",
    "svelte": "^5.0.0",
    "svelte-check": "^4.0.0",
    "typescript": "~5.6.2",
    "vite": "^6.0.3",
    "@tauri-apps/cli": "^2"
  }
}

vite.config.js

import { defineConfig } from "vite";
import { sveltekit } from "@sveltejs/kit/vite";

// @ts-expect-error process is a nodejs global
const host = process.env.TAURI_DEV_HOST;

// https://vitejs.dev/config/
export default defineConfig(async () => ({
  plugins: [sveltekit()],

  // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
  //
  // 1. prevent vite from obscuring rust errors
  clearScreen: false,
  // 2. tauri expects a fixed port, fail if that port is not available
  server: {
    port: 1420,
    strictPort: true,
    host: host || false,
    hmr: host
      ? {
          protocol: "ws",
          host,
          port: 1421,
        }
      : undefined,
    watch: {
      // 3. tell vite to ignore watching `src-tauri`
      ignored: ["**/src-tauri/**"],
    },
  },
}));

tauri.conf.json

{
  "$schema": "https://schema.tauri.app/config/2",
  "productName": "trying",
  "version": "0.1.0",
  "identifier": "com.trying.app",
  "build": {
    "beforeDevCommand": "bun run dev",
    "devUrl": "http://localhost:1420",
    "beforeBuildCommand": "bun run build",
    "frontendDist": "../build"
  },
  "app": {
    "windows": [
      {
        "title": "trying",
        "width": 800,
        "height": 600
      }
    ],
    "security": {
      "csp": null
    }
  },
  "bundle": {
    "active": true,
    "targets": "all",
    "icon": [
      "icons/32x32.png",
      "icons/128x128.png",
      "icons/128x128@2x.png",
      "icons/icon.icns",
      "icons/icon.ico"
    ]
  }
}

I'm on sequoia 15.5 (24F74) Apple M1 Pro.

 /usr/bin/xcodebuild -version
Xcode 16.4
Build version 16F6

Also my app cannot do gRPC calls I'm supposed to do in the commands

Reproduction

No response

Expected behavior

No logs.
Able to do gRPC calls.

Full tauri info output

[✔] Environment
    - OS: Mac OS 15.5.0 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.86.0 (05f9846f8 2025-03-31)
    ✔ cargo: 1.86.0 (adf9b6ad1 2025-02-28)
    ✔ rustup: 1.28.2 (e4f3ad6f8 2025-04-28)
    ✔ Rust toolchain: 1.86.0-aarch64-apple-darwin (overridden by '/Users/tdelabro/Documents/code/payment-term/paynet/rust-toolchain.toml')
    - node: 18.20.7
    - pnpm: 10.6.3
    - yarn: 1.22.22
    - npm: 10.8.2
    - bun: 1.2.12

Stack trace


Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions