Skip to content

[bug] Async commands are broken post alpha.12 #7801

@CrendKing

Description

@CrendKing

Describe the bug

Everything was fine in alpha.11. After updating to alpha.12, when the frontend invokes a command with async fn, it just times out after around 2 seconds. However, the debugger shows the command was actually called successfully. So it seems it is the callback part inside Tauri that's broken.

Reproduction

  1. pnpm create tauri-app --alpha. Right now it should uses Tauri alpha.13, which shares the problem.
  2. Add tokio dependency. Change the greeting function to async. Make the main function async.
  3. Launch the app. Type the name and click button. Notice nothing happens and error shows up in console.

Expected behavior

Async command should be usable as it always does since 1.0.

Platform and versions

[✔] Environment
    - OS: Windows 10.0.22621 X64
    ✔ WebView2: 116.0.1938.69
    ✔ MSVC: Visual Studio Build Tools 2022
    ✔ rustc: 1.72.0 (5680fa18f 2023-08-23)
    ✔ Cargo: 1.72.0 (103a7ff2e 2023-08-15)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 18.17.1
    - pnpm: 8.7.4
    - npm: 9.6.7

[-] Packages
    - tauri [RUST]: 2.0.0-alpha.13
    - tauri-build [RUST]: 2.0.0-alpha.8
    - wry [RUST]: 0.32.0
    - tao [RUST]: 0.22.2
    - @tauri-apps/api [NPM]: 2.0.0-alpha.7
    - @tauri-apps/cli [NPM]: 2.0.0-alpha.10

[-] App
    - build-type: build
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite

Stack trace

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions