Skip to content

[bug] const update = await check(); update return undefined #13020

@555chy

Description

@555chy

Describe the bug

import { check } from '@tauri-apps/plugin-updater';
import { relaunch } from '@tauri-apps/plugin-process';

const update = await check();
if (update) {
console.log(
found update ${update.version} from ${update.date} with notes ${update.body}
);
let downloaded = 0;
let contentLength = 0;
// alternatively we could also call update.download() and update.install() separately
await update.downloadAndInstall((event) => {
switch (event.event) {
case 'Started':
contentLength = event.data.contentLength;
console.log(started downloading ${event.data.contentLength} bytes);
break;
case 'Progress':
downloaded += event.data.chunkLength;
console.log(downloaded ${downloaded} from ${contentLength});
break;
case 'Finished':
console.log('download finished');
break;
}
});

console.log('update installed');
await relaunch();
}

const update = await check(); why return is undefined,and how can i get current app version?

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 x86_64 (X64)
    ✔ WebView2: 133.0.3065.92
    ✔ MSVC:
        - Visual Studio Community 2022
        - Visual Studio 生成工具 2019
    ✔ rustc: 1.85.0 (4d91de4e4 2025-02-17)
    ✔ cargo: 1.85.0 (d73d2caf9 2024-12-31)
    ✔ rustup: 1.28.1 (f9edccde0 2025-03-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 21.6.0
    - yarn: 1.22.19
    - npm: 10.2.4

[-] Packages
    - tauri 🦀: 2.3.1
    - tauri-build 🦀: 2.0.6
    - wry 🦀: 0.50.4
    - tao 🦀: 0.32.8
    - @tauri-apps/api : 2.3.0
    - @tauri-apps/cli : 2.3.1

[-] Plugins
    - tauri-plugin-updater 🦀: 2.6.0
    - @tauri-apps/plugin-updater : 2.6.0
    - tauri-plugin-opener 🦀: 2.2.6
    - @tauri-apps/plugin-opener : 2.2.6

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace


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