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

Auto update on macOS #1315

Closed
dventurino opened this issue Mar 1, 2017 · 19 comments
Closed

Auto update on macOS #1315

dventurino opened this issue Mar 1, 2017 · 19 comments

Comments

@dventurino
Copy link

  • electron-builder 14.5.2
  • electron-updater 1.8.1
  • Target: mac

Similarly to issue #1310 , I'm setting up the auto-update feature on macOS as well. The publishing process is ok, but I've got an error during the update process:

  • if there is no update, everything is ok and I receive the "No update available" message correctly, but
  • if there is an update, I get this:
[Wed Mar 01 2017 09:55:58 GMT+0100 (CET)] INFO Checking for update
[Wed Mar 01 2017 09:55:58 GMT+0100 (CET)] INFO Checking for update...
[Wed Mar 01 2017 09:55:59 GMT+0100 (CET)] ERROR Error: TypeError: this.logger.warn is not a function
    at AutoUpdater.MacUpdater.nativeUpdater.on.it (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/src/MacUpdater.ts:16:21)
    at emitTwo (events.js:106:13)
    at AutoUpdater.emit (events.js:191:7)
    at MacUpdater.onUpdateAvailable (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/src/MacUpdater.ts:29:24)
    at /Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:187:10
From previous event:
    at MacUpdater.doCheckForUpdates (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/out/AppUpdater.js:237:11)
    at /Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:142:25
    at Generator.next (<anonymous>)
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:624:5)
    at processImmediate [as _immediateCallback] (timers.js:596:5)
From previous event:
    at MacUpdater._checkForUpdates (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/out/AppUpdater.js:191:11)
    at MacUpdater.checkForUpdates (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:124:35)
    at Timeout._onTimeout (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/main.js:251:17)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)
[Wed Mar 01 2017 09:55:59 GMT+0100 (CET)] INFO Error in auto-updater.

This is the code looking for any updates:

autoUpdater.on('checking-for-update', () => {
    log.info('Checking for update...');
})
autoUpdater.on('update-available', (ev, info) => {
    log.info('Update available.');
})
autoUpdater.on('update-not-available', (ev, info) => {
    log.info('Update not available.');
})
autoUpdater.on('error', (ev, err) => {
    log.info('Error in auto-updater.');
})
autoUpdater.on('download-progress', (ev, progressObj) => {
    log.info('Downloading update...');
})
autoUpdater.on('update-downloaded', (ev, info) => {
    log.info('Update downloaded.  Will quit and install in 5 seconds.');
    // Wait 5 seconds, then quit and install
    setTimeout(function () {
        autoUpdater.quitAndInstall();
    }, 5000)
})
// Wait a second for the window to exist before checking for updates.
setTimeout(function () {
    autoUpdater.checkForUpdates();
}, 1000);
@develar
Copy link
Member

develar commented Mar 1, 2017

Is debug logging enabled?

@dventurino
Copy link
Author

dventurino commented Mar 2, 2017

Yep, this is what I see in my logs:

[Wed Mar 01 2017 09:55:58 GMT+0100 (CET)] INFO Checking for update
[Wed Mar 01 2017 09:55:58 GMT+0100 (CET)] INFO Checking for update...
[Wed Mar 01 2017 09:55:59 GMT+0100 (CET)] ERROR Error: TypeError: this.logger.warn is not a function
    at AutoUpdater.MacUpdater.nativeUpdater.on.it (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/src/MacUpdater.ts:16:21)
    at emitTwo (events.js:106:13)
    at AutoUpdater.emit (events.js:191:7)
    at MacUpdater.onUpdateAvailable (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/src/MacUpdater.ts:29:24)
    at /Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:187:10
From previous event:
    at MacUpdater.doCheckForUpdates (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/out/AppUpdater.js:237:11)
    at /Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:142:25
    at Generator.next (<anonymous>)
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:624:5)
    at processImmediate [as _immediateCallback] (timers.js:596:5)
From previous event:
    at MacUpdater._checkForUpdates (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/out/AppUpdater.js:191:11)
    at MacUpdater.checkForUpdates (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:124:35)
    at Timeout._onTimeout (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/main.js:251:17)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)
[Wed Mar 01 2017 09:55:59 GMT+0100 (CET)] INFO Error in auto-updater.

@develar
Copy link
Member

develar commented Mar 2, 2017

I cannot yet check code, but you can try to: logger.warn = logger.info

@dventurino
Copy link
Author

That seems to have fixed it. I still have some error because the app is not correctly signed, but I'll look into it as soon as I can

@dventurino
Copy link
Author

dventurino commented Mar 3, 2017

I get a warning about the application not being signed (and it's not yet), then the new version on s3 is detected as an available update, but the download does not start or it gets stuck.

Here are the logs:

INFO Checking for update
INFO Checking for update...
DEBUG { Error: Could not get code signature for running application
at MacUpdater.onUpdateAvailable (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/src/MacUpdater.ts:29:24)
at /Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:187:10
at Generator.next ()
at Generator.tryCatcher (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/bluebird/js/release/util.js:16:23)
at PromiseSpawn._promiseFulfilled (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/bluebird/js/release/generators.js:97:49)
at Async._drainQueue (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)
preventDefault: [Function: preventDefault],
sender:
AutoUpdater {
_events: { error: [Function], 'update-downloaded': [Function] },
_eventsCount: 2 } }
ERROR Error: Error: Could not get code signature for running application
at MacUpdater.onUpdateAvailable (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/src/MacUpdater.ts:29:24)
at /Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:187:10
at Generator.next ()
at Generator.tryCatcher (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/bluebird/js/release/util.js:16:23)
at PromiseSpawn._promiseFulfilled (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/bluebird/js/release/generators.js:97:49)
at Async._drainQueue (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/Users/Daniele/git/box/dist/mac/box.app/Contents/Resources/app.asar/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)
INFO Error in auto-updater.
INFO Found version 1.0.0 (url: https://mybucket.s3.amazonaws.com/setup/test/box/box-1.0.0-mac.zip)
INFO Update available.
INFO Downloading update from https://mybucket.s3.amazonaws.com/setup/test/box/box-1.0.0-mac.zip

@mediaslav
Copy link

For Mac autoupdate app is required to be signed

@dventurino
Copy link
Author

@develar is the signature mandatory even for testing purposes ?

@develar
Copy link
Member

develar commented Mar 7, 2017

Always required. You can use free Mac Developer cert. It is Squirrel.Mac requirement.

@develar develar added bug and removed reply-needed labels Mar 7, 2017
@dventurino
Copy link
Author

👍 ok I tried a dummy Mac Developer certificate and it worked!

Now I've got to generate a good one. I do not use Xcode, but maybe there is a way to get one without it. Thanks again

@AlienHoboken
Copy link
Contributor

Move to close?

@ccnokes
Copy link

ccnokes commented Mar 29, 2017

This is not related to this issue (sorry). @dventurino where do you get the free/dummy mac dev certificate?

@develar
Copy link
Member

develar commented Mar 29, 2017

This issue is not closed because TypeError: this.logger.warn is not a function is not yet investigated and fixed.

@dventurino
Copy link
Author

@ccnokes I had a mac development certificate generated on machine (with Xcode) at work. It's good enough for development purpouse, but not for production.

@alexcroox
Copy link

alexcroox commented May 29, 2017

@dventurino Where in Xcode do you create this? I'd created my own in osx keychain before but not sure where to get a free "mac development" one from within Xcode?

@dventurino
Copy link
Author

@alexcroox
Xcode -> Preferences -> Account -> Manage certificates -> + -> macOs Development
schermata 2017-05-30 alle 10 36 29

@alexcroox
Copy link

@dventurino thanks, and I assume if I'm exporting this I can share with other team mates who can use it to sign new releases from their own machines with it? (it's an internal tool so a development cert is fine for auto updates)

@bill-pixvana
Copy link

Yes, I use Keychain Access to export the credential and key as a .p12 to be imported on another mac via Keychain Access.

@dventurino
Copy link
Author

@alexcroox yep! As @bill-pixvana said, you just have to share with them the .p12 file.

@develar
Copy link
Member

develar commented Jun 5, 2017

TypeError — Obsolete since electron-updater 2.0.0 (will be released today).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants