electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

Electron Updater Downloads But Never Installs Update MAC

Open sahil-liscio opened this issue 1 year ago • 31 comments

  • Electron-Builder Version: 23.3.3
  • Node Version: 16.15.0
  • Electron Version: 18.2.3
  • Electron Type (current, beta, nightly):
  • Electron-Updater Version: 5.2.1
  • Target: MAC [dmg,zip]

I am able to manually download the update from an S3 app. The app successfully quits but the update never gets installed. When I open up the app again, it says update available, then quits the app again immediately as the update-downloaded event fires. I have tried calling quitandInstall after timeouts, removing all listeners for close and windows-all closed, call app.exit manually. Nothing helps.

Checking electron updater logs, when I first try to download the update this is what I see. [2022-08-09 09:32:36.173] [info] Checking for update [2022-08-09 09:32:36.580] [info] Found version 1.1.7 (url: <zip>, <dmg>) [2022-08-09 09:32:38.075] [info] Downloading update from <zip>, <dmg> [2022-08-09 09:32:38.087] [info] Checked for macOS Rosetta environment (isRosetta=false) [2022-08-09 09:32:38.090] [info] Checked 'uname -a': arm64=true [2022-08-09 09:32:38.093] [info] Cached update sha512 checksum doesn't match the latest available update. New update must be downloaded. Cached: U6TJwAcNK+wthCSeu/49Cr+JINR6GoACwyiq7qVwaB/joQh5pcFZSHv83fM4xPBIuo1a5It1vl+pmhB0vuokXg==, expected: AT8INhTWhiddcYNtgBs2i0wXJ0+m8O9m/q5toQJAZg2X29qUPIvMtAXg3fVvBIu2z0xYm43Ph2g9Dpmb+/oaQw==. Directory for cached update will be cleaned [2022-08-09 09:32:57.217] [info] New version 1.1.7 has been downloaded to <File Path here>1.1.7-arm64-mac.zip [2022-08-09 09:33:02.289] [info] / requested

After that /requested call, nothing happens no matter how long I wait and then when I start the app manually since it doesn't relaunch, I get the update-available event, and it tries downloading again, but since its already downloaded it calls quite and install again. The logs for the subsequent tries are as follows. [2022-08-09 09:47:43.455] [info] Checking for update [2022-08-09 09:47:43.940] [info] Found version 1.1.7 (url: <zip>, <dmg>) [2022-08-09 09:47:48.361] [info] Downloading update from <zip>, <dmg> [2022-08-09 09:47:48.379] [info] Checked for macOS Rosetta environment (isRosetta=false) [2022-08-09 09:47:48.391] [info] Checked 'uname -a': arm64=true [2022-08-09 09:47:48.500] [info] Update has already been downloaded to /<File Path here>-1.1.7-arm64-mac.zip). [2022-08-09 09:47:53.563] [info] / requested

Then gets stuck again.

The Update successfully downloads but never gets installed.

[2022-08-09 12:11:29.190] [info] /41e55b6ef23c4370f4023b1c7b36dce4c7c78e504e2f590ef0355294e1d49c34a79acf4f5dfd4d8e59c06150ce73f415a0355770670b7fdcefc06d558dc2fd6f.zip requested [2022-08-09 12:11:29.190] [info] /41e55b6ef23c4370f4023b1c7b36dce4c7c78e504e2f590ef0355294e1d49c34a79acf4f5dfd4d8e59c06150ce73f415a0355770670b7fdcefc06d558dc2fd6f.zip requested by Squirrel.Mac, pipe<File Path here> -1.1.8-arm64-mac.zip

I get these new logs now when I download the update, but still no install.

EDIT:

The autoupdate does not work on my laptop, but it installs fine on a different laptop I am running MacOS Monterey 12.3.1 Is the issue a MacOS issue or because I am updating from the same laptop I published the update on.

sahil-liscio avatar Aug 09 '22 17:08 sahil-liscio

Hi, I am also having a similar issue, on windows the update works, however, when I try on mac osx Monterey it just downloads and does not install the update.

Is this an issue with OSX Monterey?

ratanservegar avatar Aug 10 '22 15:08 ratanservegar

Works for me on Monterey 12.1 Node 16.15

        "electron": "^16.0.6",
        "electron-builder": "^22.14.5",

Amethystafyy282 avatar Aug 12 '22 02:08 Amethystafyy282

Hi @Amethystafyy282,

We are on Electron 4 and won't be able to upgrade to the latest version due to dependencies

ratanservegar avatar Aug 12 '22 03:08 ratanservegar

@ratanservegar I am using electron 18.2.3 and still facing that issue, so I am not sure it is a version issue

sahil-liscio avatar Aug 12 '22 03:08 sahil-liscio

[2022-08-09 09:32:38.093] [info] Cached update sha512 checksum doesn't match the latest available update. New update must be downloaded. Cached:

I think your new version on S3 has been corrupted, can you try to use github first? Im using custom S3 server too but everything is fine. Use everything as default so we can debug from one to another.

Basic flow:

  1. Check for updates. If available, download. (default = true).
  2. When update-downloaded triggered. Call quitAndInstall.
[2022-08-09 09:32:38.093] [info] Cached update sha512 checksum doesn't match the latest available update. New update must be downloaded. Cached:

Amethystafyy282 avatar Aug 12 '22 03:08 Amethystafyy282

@sahil-liscio, yeah. I wish someone from the electron-builder team would respond and point us in the right direction.

P.S: I am going to downgrade my Mac OSX version from Monterey and see if that help. will keep you posted on the same.

ratanservegar avatar Aug 12 '22 03:08 ratanservegar

I'm the only person on the electron-builder team, unfortunately, I'm not sure of what direction to point you in. I've yet to use electron-updater in my work project, which has a custom update flow for dmg's.

@ratanservegar why can't you upgrade to latest electron-builder and electron-updater? If it's related to fs-promises, that was fixed a while ago as I migrated the project back to fs-extra to allow for broader node version support

mmaietta avatar Aug 12 '22 20:08 mmaietta

@mmaietta we are on electron 4.0.7 and I believe a lot of things like web view have been depreciated and would require significant re-write.

ratanservegar avatar Aug 13 '22 07:08 ratanservegar

I'm the only person on the electron-builder team, unfortunately, I'm not sure of what direction to point you in. I've yet to use electron-updater in my work project, which has a custom update flow for dmg's.

@ratanservegar why can't you upgrade to latest electron-builder and electron-updater? If it's related to fs-promises, that was fixed a while ago as I migrated the project back to fs-extra to allow for broader node version support

I have the same problem with my application for macOS build. I have updated theelectron-updater, electron-builder packages, but the problem remains. My versions:

  1. node - v16.16.0
  2. electron - v19.0.0
  3. electron-builder - v23.3.3
  4. electron-updater - v5.2.1

But to be more precise, the update is downloading, but after the "update-downloaded" event, you need to wait about 6 seconds and run autoUpdater.quitAndInstall()

trae-op avatar Aug 15 '22 16:08 trae-op

@trae-op so setTimeout for 6 seconds? is it machine specific wait time? or just 6 seconds overall for it to work?

ratanservegar avatar Aug 15 '22 17:08 ratanservegar

@trae-op so setTimeout for 6 seconds? is it machine specific wait time? or just 6 seconds overall for it to work?

Yes, about 6 seconds overall for it to work. Yes, can use setTimeout and specify 6000 then run autoUpdater.quitAndInstall(), but this is more of a temporary solution. But I have a task to fix this bug and the setTimeout solution is not suitable. I hope the electron-updater package author will fix this bug.

trae-op avatar Aug 16 '22 08:08 trae-op

I'm the only person on the electron-builder team, unfortunately, I'm not sure of what direction to point you in. I've yet to use electron-updater in my work project, which has a custom update flow for dmg's. @ratanservegar why can't you upgrade to latest electron-builder and electron-updater? If it's related to fs-promises, that was fixed a while ago as I migrated the project back to fs-extra to allow for broader node version support

I have the same problem with my application for macOS build. I have updated theelectron-updater, electron-builder packages, but the problem remains. My versions:

  1. node - v16.16.0
  2. electron - v19.0.0
  3. electron-builder - v23.3.3
  4. electron-updater - v5.2.1

But to be more precise, the update is downloading, but after the "update-downloaded" event, you need to wait about 6 seconds and run autoUpdater.quitAndInstall()

Forgot to clarify. I have macOS Mojave

trae-op avatar Aug 16 '22 08:08 trae-op

@trae-op Thanks, I will try this out and let you know if it works for me!

ratanservegar avatar Aug 16 '22 09:08 ratanservegar

@mmaietta, As a additional troubleshooting process on OSX Monterey(normal installation, not Updation). I am doing a dist on .zip. When I go to the dist folder and try extract the .zip file and then run the .app it fails to even launch. However, If I go into the mac folder (inside dis.) and run the .app from there, then it installs without any issues. Maybe some kind of issue with the zipping process that is causing the update to fail?

ratanservegar avatar Aug 16 '22 09:08 ratanservegar

I'm doubtful that it has anything to do with the zipping process as that logic hasn't been changed in years and is the only way mac auto-updates are able to work, so any issues there would have had far more widespread reports.

mmaietta avatar Aug 16 '22 16:08 mmaietta

@mmaietta found this thread - https://github.com/electron-userland/electron-builder/issues/4299 maybe this gives you more info?

ratanservegar avatar Aug 17 '22 12:08 ratanservegar

I'm fairly confident that is unrelated. The fix for that issue was to not embed the blockmap since that modified the zip signature, and using the latest electron-builder includes that fix. I noticed you're on an arm64 device. Can you confirm that your .app is notarized as well?

mmaietta avatar Aug 17 '22 15:08 mmaietta

@mmaietta no, our .app isn't notarized.

I am on the following version "electron": "^4.0.7", "electron-builder": "^20.40.2"

Can i update electron-builder to the latest without updating electron?

ratanservegar avatar Aug 17 '22 17:08 ratanservegar

Please update to latest electron-builder and electron-updater. It should be agnostic from your electron version. There was a time when it wasn't due to fs/promises API usage, but I changed it to leverage fs-extra for backward compatibility with older electron versions.

mmaietta avatar Aug 17 '22 19:08 mmaietta

Ok will do. But does the app need to notarized for the update process to work? Why does the .app inside the zip not get signed?

ratanservegar avatar Aug 17 '22 20:08 ratanservegar

Ok will do. But does the app need to notarized for the update process to work? Why does the .app inside the zip not get signed?

It does need to for the auto update to work. https://www.electronjs.org/docs/latest/tutorial/code-signing#signing--notarizing-macos-builds.

Sign and notarize are different process.

Amethystafyy282 avatar Aug 18 '22 01:08 Amethystafyy282

@Amethystafyy282 but the problem is the .app inside the .zip which is created after running the dist isn't being signed. only once the app is signed I can notarize it.

ratanservegar avatar Aug 18 '22 10:08 ratanservegar

@mmaietta no, our .app isn't notarized.

I am on the following version "electron": "^4.0.7", "electron-builder": "^20.40.2"

Can i update electron-builder to the latest without updating electron?

Unbelievable! Your version is very low "electron": "^4.0.7" And how is it still working for you? Must to update and rewrite for the new version

trae-op avatar Aug 18 '22 11:08 trae-op

@mmaietta @Amethystafyy282 After upgrading electron-builder and electron-packager, to latest versions,

"electron-builder": "^23.3.3",
"electron-packager": "^15.5.1",

electron is at "electron": "^4.0.7"

when I try to open the app, I see following error. error

contents of my dist folder are, contents

yogeshk25 avatar Aug 18 '22 15:08 yogeshk25

@yogeshk25 you need to also update electron-updater to latest

mmaietta avatar Aug 18 '22 20:08 mmaietta

@Amethystafyy282 but the problem is the .app inside the .zip which is created after running the dist isn't being signed. only once the app is signed I can notarize it.

Dont manually notarize it, let the electron do it by putting logic in electron-builder, please read the docs carefully, its all in there.

afterSign: notarize.js

Amethystafyy282 avatar Aug 19 '22 01:08 Amethystafyy282

@Amethystafyy282 in the past when we have done builds, we have never notarized the application as we do not distribute it via the app store, this is an internal application. The current application which is running was signed using a different apple developer account (the developer is no longer with us) hence we need to change the applications certificate to a new developer account signed disturbed certificate.

But on the new OSX we are unable to get the .app inside the .zip to work.

ratanservegar avatar Aug 19 '22 09:08 ratanservegar

@Amethystafyy282 in the past when we have done builds, we have never notarized the application as we do not distribute it via the app store, this is an internal application. The current application which is running was signed using a different apple developer account (the developer is no longer with us) hence we need to change the applications certificate to a new developer account signed disturbed certificate.

But on the new OSX we are unable to get the .app inside the .zip to work.

For auto-updater to work on Mac, you have to sign and notarize it.

Signing with another account will cause the application cannot be installed automatically by electron-updater due to different signatures. The user will have to do it manually.

Amethystafyy282 avatar Aug 19 '22 09:08 Amethystafyy282

@mmaietta please check the log attached below. So it seems like there is something wrong with the Archive/Unarchiving on Mac osx Monterey. Even though the files are un-touch post signing the hash the application gets when trying to update is incorrect.

Here is what I did, validated the hash of the update file matches the one in the yaml file and then when the application downloads the update file and tries to update the sha check fails.

log.log

ratanservegar avatar Aug 21 '22 18:08 ratanservegar

@ratanservegar I think that was the exact issue I was facing, I got a hash mismatch log to but mine wasn't an error but rather info but the update didn't work.

sahil-liscio avatar Aug 21 '22 18:08 sahil-liscio