electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.64k stars 1.74k forks source link

Question: electron-builder stops on checking for update #8587

Open jrohlandt opened 1 week ago

jrohlandt commented 1 week ago

I'm using electron-updater 6.3.

It works fine for auto updates on Windows and Mac but I have this one Mac user who is sometimes have issues. Specifically when there are no updates available.

In that case I can see from logging out that electron-updater only get to this point (see attached screenshot). It only gets to "Checking for update". It never reaches the "update-not-available" event.

I don't get any errors either.

I'm using Github releases. I know I'm not giving much information here but does anyone know common reasons why this would happen?

image

mmaietta commented 4 days ago

This might be where it's stalling for this specific user and there are no network calls being executed or errors being logged https://github.com/electron-userland/electron-builder/blob/74d98d8aaecf1f6ee2fbd7b639972d3eab1cd0c5/packages/electron-updater/src/AppUpdater.ts#L426-L432

I took a look at configOnDisk and nothing seems awry to me there, it's just generating a config and loading a file from process.resourcesPath. My best guess is that await this.app.whenReady() is never resolving true, but that just sounds unreasonable to me.

Would you mind testing out this patch with patch-package to add more logs? electron-updater+6.3.9.patch (Note this patch is on top of latest v6.3.9)

diff --git a/node_modules/electron-updater/out/AppUpdater.js b/node_modules/electron-updater/out/AppUpdater.js
index 2a54aeb..b81bf55 100644
--- a/node_modules/electron-updater/out/AppUpdater.js
+++ b/node_modules/electron-updater/out/AppUpdater.js
@@ -332,13 +332,18 @@ class AppUpdater extends events_1.EventEmitter {
         return this.allowDowngrade && isLatestVersionOlder;
     }
     async getUpdateInfoAndProvider() {
+        var _a, _b, _c, _d;
+        (_a = this.logger) === null || _a === void 0 ? void 0 : _a.info("waiting for app to be ready");
         await this.app.whenReady();
+        (_b = this.logger) === null || _b === void 0 ? void 0 : _b.info("app is ready");
         if (this.clientPromise == null) {
             this.clientPromise = this.configOnDisk.value.then(it => (0, providerFactory_1.createClient)(it, this, this.createProviderRuntimeOptions()));
         }
+        (_c = this.logger) === null || _c === void 0 ? void 0 : _c.info("reading config");
         const client = await this.clientPromise;
         const stagingUserId = await this.stagingUserIdPromise.value;
         client.setRequestHeaders(this.computeFinalHeaders({ "x-user-staging-id": stagingUserId }));
+        (_d = this.logger) === null || _d === void 0 ? void 0 : _d.info("completed getUpdateInfoAndProvider");
         return {
             info: await client.getLatestVersion(),
             provider: client,