tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
85.38k stars 2.58k forks source link

[bug] The check function does not work if you use it with timeout only #11675

Closed einz-loggik closed 1 week ago

einz-loggik commented 1 week ago

Describe the bug

I really like Tauri, its really great. But it seems that i found a bug.

I try to use the check function of the updater with Javascript. This works perfectly fine.

const update = await check()

But as soon as i add a timeout i get a 'Unhandled Promise Rejection: Could not fetch a valid release JSON from the remote' error const update = await check({ timeout: 5 })

The response from the server is the same in both cases.

Reproduction

Use the check function like in the second example

Expected behavior

The check function works the same as with no arguments and stops if the timeout is reached

Full tauri info output

[✔] Environment
    - OS: Mac OS 12.6.8 x86_64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-apple-darwin (default)
    - node: 20.10.0
    - npm: 10.8.3
    - bun: 1.1.0

[-] Packages
    - tauri 🦀: 2.0.6
    - tauri-build 🦀: 2.0.2
    - wry 🦀: 0.46.3
    - tao 🦀: 0.30.5
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli : 2.0.5 (outdated, latest: 2.1.0)

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : 2.0.1
    - tauri-plugin-process 🦀: 2.0.1
    - @tauri-apps/plugin-process : 2.0.0
    - tauri-plugin-updater 🦀: 2.0.2
    - @tauri-apps/plugin-updater : 2.0.0
    - tauri-plugin-log 🦀: 2.0.1
    - @tauri-apps/plugin-log : not installed!

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:3000/
    - framework: Vue.js (Nuxt)
    - bundler: Vite

Stack trace

No response

Additional context

No response

FabianLars commented 1 week ago

timeout is specified in miliseconds and 5ms is an insanely short timeout realistically only usable on localhost. So, just to be sure, did you try larger values like 5000 (== 5 seconds) for example?

einz-loggik commented 1 week ago

Ok so the bug is in the documentation, because the documentation says its in seconds, not milliseconds.

image

I will create a PR to update the documentation.

Thank you for the info.