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

[bug] can't get the updater status #7128

Closed
xdewx opened this issue Jun 4, 2023 · 8 comments
Closed

[bug] can't get the updater status #7128

xdewx opened this issue Jun 4, 2023 · 8 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@xdewx
Copy link

xdewx commented Jun 4, 2023

Describe the bug

how to get the status of emit('tauri://update')? onUpdaterEvent seems not work.
I found that the dialog will show when there is a new version available, but nothing happens when not.

  1. if there exists a newer version, dialog will show
  2. if currentVersion.json not exist, nothing happens. In fact, Promise.reject expected
  3. if cuurentVersion.json exists but version in it not greater than currentVersion, nothing happens. In fact, Promise.reject expected

Reproduction

No response

Expected behavior

No response

Platform and versions

windows
tauri 1.3.0

Stack trace

No response

Additional context

No response

@xdewx xdewx added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jun 4, 2023
@FabianLars
Copy link
Member

Thanks for the report! Could you share a reproduction example we can take a look at? 🙏

@xdewx
Copy link
Author

xdewx commented Jun 5, 2023

Thanks for the report! Could you share a reproduction example we can take a look at? 🙏

the reproduction example completely follows https://tauri.app/zh-cn/v1/guides/distribution/updater. because need a public ip, so it's not easy to give a real example.

Maybe we can analyze the logic of @tauri-apps/api/updater directly and make sure it can handle the following cases:

  1. when currentVersion.json is missing
  2. when version in currentVersion.json is not greater than currentVersion
  3. when the format of currentVersion.json is invalid
  4. when network error
  5. when domain is behinds of cloudflare

@FabianLars
Copy link
Member

FabianLars commented Jun 5, 2023

Most of that should be reported by onUpdaterEvent, but only if you trigger it via emit('tauri://update') since the inbuilt check from the default dialog runs too early for it to be registered (on app start).

Since it doesn't report anything for you, you can also try the rust counterpart as a sanity check:

let app = tauri::Builder::default().build(tauri::generate_context!()).expect("error building tauri app");

app.run(|_app_handle, event| {
  if let RunEvent::Updater(updater_event) = event {
    dbg!(updater_event);
  }
});

@xdewx
Copy link
Author

xdewx commented Jun 5, 2023

Most of that should be reported by onUpdaterEvent, but only if you trigger it via emit('tauri://update') since the inbuilt check from the default dialog runs too early for it to be registered (on app start).

but, if i invoke checkUpdate & onUpdaterEvent manually again, will i receive the events in my onUpdaterEvent?
In my testing, it failed.

@FabianLars
Copy link
Member

For visibility, the testing we did on Discord so far showed that, if we use the server approach works, but the static json approach never resolves the checkUpdate promise

@FabianLars
Copy link
Member

Okay so i forgot that the events are limited if you enable the default dialog, because tauri still logs most of the events.

I'm a bit unsure what the best approach is tbh:

Currently lean towards 1&2 but idk...

@xdewx
Copy link
Author

xdewx commented Jun 5, 2023

image
In my opinion, I think a call to checkUpdate should respond regardless of whether the dialog switch is present. The dialog switch only controls whether a call is automatically completed and related events are emitted during system initialization. The rest of the scenario api just needs to live up to its name.

And by the way, it seems that updater can only upgrade step by step, it would be better if there is a latest.json, that is:

  1. first check latest.json,if exists, upgrade any current version to the latest version
  2. if not exist latest.json, check currentVersion.json

if only check currentVersion, the developer have to keep all version.json updated when there is a new version.

@amrbashir
Copy link
Member

@FabianLars just patch the current implementation for it to barely work. v2 will have a better implementation and straight-forward JS API.

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