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

Windows 10 autoUpdater not installing update #1640

Closed
brandonhilkert opened this issue Jun 9, 2017 · 4 comments
Closed

Windows 10 autoUpdater not installing update #1640

brandonhilkert opened this issue Jun 9, 2017 · 4 comments

Comments

@brandonhilkert
Copy link

brandonhilkert commented Jun 9, 2017

  • Version: 18.3.0
  • autoUpdater: 2.0.0
  • Target: Windows 10

I've put together autoUpdating for my app with message dialogs triggered from a menu and it works great on MacOS. However, on Windows, after accepting to download the update, it never installs:

[2017-06-09 15:05:14:0446] [info] Application started
[2017-06-09 15:05:21:0571] [info] Checking for update
[2017-06-09 15:05:35:0957] [info] iTunes monitoring started: C:\Users\Brandon\AppData\Roaming/Apple Computer/MobileSync/Backup
[2017-06-09 15:05:37:0348] [info] Found version 1.0.0 (url: https://bark-desktop-downloads.s3.amazonaws.com/Bark Setup 1.0.0.exe)
[2017-06-09 15:05:37:0348] [info] { version: '1.0.0',
  releaseDate: '2017-06-09T18:47:53.604Z',
  githubArtifactName: 'Bark-Setup-1.0.0.exe',
  path: 'Bark Setup 1.0.0.exe',
  sha512: '5fada21a4809d0d2d532433c75ef94e93d1d5ee5c7ecfd72272a10350fc4878a6fd0edb6b2d06840a292eb3739cc6316b3b4b11ae2a9a9d8175d4dd96a3e531f',
  sha2: 'fbb89b9002bb8cba7a2d41f26cb45786f76c2a1313cdef051d8874cbf3270b06' }
[2017-06-09 15:05:37:0364] [info] A new version of Bark is available:  { version: '1.0.0',
  releaseDate: '2017-06-09T18:47:53.604Z',
  githubArtifactName: 'Bark-Setup-1.0.0.exe',
  path: 'Bark Setup 1.0.0.exe',
  sha512: '5fada21a4809d0d2d532433c75ef94e93d1d5ee5c7ecfd72272a10350fc4878a6fd0edb6b2d06840a292eb3739cc6316b3b4b11ae2a9a9d8175d4dd96a3e531f',
  sha2: 'fbb89b9002bb8cba7a2d41f26cb45786f76c2a1313cdef051d8874cbf3270b06' }
[2017-06-09 15:05:41:0708] [info] Downloading update from https://bark-desktop-downloads.s3.amazonaws.com/Bark Setup 1.0.0.exe

I've given it a lot of time and it just sits there. On start of the app i have it to check for updates too, and the same thing will happen --- it'll prompt there's an update and I'll choose to download and it'll leave off at the same place in the logs above.

Here's the code that runs autoUpdate, anything more I can enable to see what's going on?

autoUpdater.logger                       = log
autoUpdater.logger.transports.file.level = "info"
autoUpdater.autoDownload                 = false

  autoUpdater.addListener("update-available", (info) => {
    log.info(info);
    log.info("A new version of Bark is available: ", info);

    if (!mainWindow.isVisible()) {
      showWindow()
    }

    dialog.showMessageBox({
      type:      'info',
      title:     'Bark Update',
      message:   'A new version of ' + app.getName() + ' is available!',
      buttons:   ['Download Update', 'No, thanks'],
      defaultId: 0,
      cancelId:  1,
    }, (buttonIndex) => {
      log.debug('User responded to update restart request with ' + buttonIndex);

      if (buttonIndex === 0) {
        autoUpdater.downloadUpdate();
      }
    });
  });

  autoUpdater.addListener("update-downloaded", (info) => {
    log.info("A new update is ready to install: ", info);

    if (!mainWindow.isVisible()) {
      showWindow()
    }

    dialog.showMessageBox({
      type:      'info',
      title:     'Bark Update',
      message:   'A new version of ' + app.getName() + ' is ready to install!',
      buttons:   ['Install and Restart', 'Not now'],
      defaultId: 0,
      cancelId:  1,
    }, (buttonIndex) => {
      log.debug('User responded to update restart request with ' + buttonIndex);

      if (buttonIndex === 0) {
        autoUpdater.quitAndInstall();
      }
    });
  });
@develar
Copy link
Member

develar commented Jun 9, 2017

As electron-updater 2 was released only a week ago, please use electron-builder 18.6.0 and latest electron-updater 2.1

No — your code is not quite correct — please do not call autoUpdater methods from dialog message box handler, please use setImmediate. #1604 (comment)

@brandonhilkert
Copy link
Author

Updated to 18.6.2 and 2.1.2 and got the same behavior (this version works well on MacOS -- as before). Adjusted main.js to:

  autoUpdater.addListener("update-downloaded", (info) => {
    log.info("A new update is ready to install: ", info);

    if (!mainWindow.isVisible()) {
      showWindow()
    }

    dialog.showMessageBox({
      type:      'info',
      title:     'Bark Update',
      message:   'A new version of ' + app.getName() + ' is ready to install!',
      buttons:   ['Install and Restart', 'Not now'],
      defaultId: 0,
      cancelId:  1,
    }, (buttonIndex) => {
      log.debug('User responded to update restart request with ' + buttonIndex);

      if (buttonIndex === 0) {
        setImmediate(() => {
          app.removeAllListeners("window-all-closed")

          if (mainWindow != null) {
            mainWindow.close()
          }
          autoUpdater.quitAndInstall(false)
        })
      }
    });

@brandonhilkert
Copy link
Author

I tried a few more changes within the dialog and it went further this time, but now I got the error below.

Any insight would be super helpful.

I'm using the following script to release:

WIN_CSC_LINK=./.bark-electron-win.p12 CSC_LINK=./.bark-electron.p12 build -mw --x64 --ia32 --em.main=build/main.js --publish always
[2017-06-09 17:09:09:0931] [info] Sign verification failed, installer signed with incorrect certificate: {
  "SignerCertificate": {
    "FriendlyName": "",
    "IssuerName": {
      "Name": "CN=DigiCert SHA2 High Assurance Code Signing CA, OU=www.digicert.com, O=DigiCert Inc, C=US",
      "Oid": "System.Security.Cryptography.Oid"
    },
    "NotAfter": "/Date(1528372800000)/",
    "NotBefore": "/Date(1496361600000)/",
    "PrivateKey": null,
    "PublicKey": {
      "Key": "System.Security.Cryptography.RSACryptoServiceProvider",
      "Oid": "System.Security.Cryptography.Oid",
      "EncodedKeyValue": "System.Security.Cryptography.AsnEncodedData",
      "EncodedParameters": "System.Security.Cryptography.AsnEncodedData"
    },
    "SerialNumber": "05675754F4B0E04A8123129B44A65D92",
    "SubjectName": {
      "Name": "CN=\"Bark Technologies, Inc\", O=\"Bark Technologies, Inc\", L=Richmond Hill, S=Georgia, C=US",
      "Oid": "System.Security.Cryptography.Oid"
    },
    "SignatureAlgorithm": {
      "Value": "1.2.840.113549.1.1.11",
      "FriendlyName": "sha256RSA"
    },
    "Thumbprint": "BC5BF06603F25DBFAF1DAD0A697D691043355171",
    "Version": 3,
    "Issuer": "CN=DigiCert SHA2 High Assurance Code Signing CA, OU=www.digicert.com, O=DigiCert Inc, C=US",
    "Subject": "CN=\"Bark Technologies, Inc\", O=\"Bark Technologies, Inc\", L=Richmond Hill, S=Georgia, C=US"
  },
  "TimeStamperCertificate": null,
  "Status": 0,
  "StatusMessage": "Signature verified."
}
[2017-06-09 17:09:09:0946] [error] Error: Error: New version 1.0.4 is not signed by the application owner: {
  "SignerCertificate": {
    "FriendlyName": "",
    "IssuerName": {
      "Name": "CN=DigiCert SHA2 High Assurance Code Signing CA, OU=www.digicert.com, O=DigiCert Inc, C=US",
      "Oid": "System.Security.Cryptography.Oid"
    },
    "NotAfter": "/Date(1528372800000)/",
    "NotBefore": "/Date(1496361600000)/",
    "PrivateKey": null,
    "PublicKey": {
      "Key": "System.Security.Cryptography.RSACryptoServiceProvider",
      "Oid": "System.Security.Cryptography.Oid",
      "EncodedKeyValue": "System.Security.Cryptography.AsnEncodedData",
      "EncodedParameters": "System.Security.Cryptography.AsnEncodedData"
    },
    "SerialNumber": "05675754F4B0E04A8123129B44A65D92",
    "SubjectName": {
      "Name": "CN=\"Bark Technologies, Inc\", O=\"Bark Technologies, Inc\", L=Richmond Hill, S=Georgia, C=US",
      "Oid": "System.Security.Cryptography.Oid"
    },
    "SignatureAlgorithm": {
      "Value": "1.2.840.113549.1.1.11",
      "FriendlyName": "sha256RSA"
    },
    "Thumbprint": "BC5BF06603F25DBFAF1DAD0A697D691043355171",
    "Version": 3,
    "Issuer": "CN=DigiCert SHA2 High Assurance Code Signing CA, OU=www.digicert.com, O=DigiCert Inc, C=US",
    "Subject": "CN=\"Bark Technologies, Inc\", O=\"Bark Technologies, Inc\", L=Richmond Hill, S=Georgia, C=US"
  },
  "TimeStamperCertificate": null,
  "Status": 0,
  "StatusMessage": "Signature verified."
}
    at C:\Users\Brandon\AppData\Local\Programs\Bark\resources\app.asar\node_modules\electron-updater\src\NsisUpdater.ts:65:15
    at Generator.next (<anonymous>)
    at FSReqWrap.CB [as oncomplete] (C:\Users\Brandon\AppData\Local\Programs\Bark\resources\app.asar\node_modules\fs-extra-p\node_modules\fs-extra\lib\remove\rimraf.js:57:5)
From previous event:
    at NsisUpdater.doDownloadUpdate (C:\Users\Brandon\AppData\Local\Programs\Bark\resources\app.asar\node_modules\electron-updater\out\NsisUpdater.js:120:11)
    at C:\Users\Brandon\AppData\Local\Programs\Bark\resources\app.asar\node_modules\electron-updater\src\AppUpdater.ts:246:25
    at Generator.next (<anonymous>)
From previous event:
    at NsisUpdater.downloadUpdate (C:\Users\Brandon\AppData\Local\Programs\Bark\resources\app.asar\node_modules\electron-updater\out\AppUpdater.js:289:11)
    at Immediate.setImmediate (C:\Users\Brandon\AppData\Local\Programs\Bark\resources\app.asar\build\main.js:52:23)
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:624:5)
    at processImmediate [as _immediateCallback] (timers.js:596:5)

@brandonhilkert
Copy link
Author

Closing in favor of #1641

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

No branches or pull requests

2 participants