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

Nsis app from fall 2017 (electron-updater 2.10.0) won't update to new version #2583

Closed
baversjo opened this issue Feb 14, 2018 · 13 comments · May be fixed by qcif/data-curator#563
Closed

Nsis app from fall 2017 (electron-updater 2.10.0) won't update to new version #2583

baversjo opened this issue Feb 14, 2018 · 13 comments · May be fixed by qcif/data-curator#563

Comments

@baversjo
Copy link

baversjo commented Feb 14, 2018

Hi, I have a windows electron app that's in production with with electron-updater 2.10.0 / electron-builder 19.30.2.

Today I tried to deploy and update with electron-builder 20.0.4 and electron-updater 2.20.2. However the clients failed to install the update with a weird 404 when trying to download the .exe (see logs below)

I'm publishing a dual x64 x86 nsis-web installer to s3, this is the same as with the version that's in production currently.

Here's the latest.yml that the clients are fetching from: https://s3.amazonaws.com/smrt-releases/latest.yml
Here's the installer clients are downloading: https://s3.amazonaws.com/smrt-releases/SMRT+Web+Setup+2.4.3.exe

{"level":"info","message":"update check poll","timestamp":"2018-02-14T14:49:28.892Z"}
{"level":"info","message":"Checking for update","timestamp":"2018-02-14T14:49:28.896Z"}
{"level":"info","message":"looking for update","timestamp":"2018-02-14T14:49:28.896Z"}
{"level":"info","message":"Found version 2.4.1 (url: https://smrt-releases.s3.amazonaws.com/SMRT%20Web%20Setup%202.4.1.exe)","timestamp":"2018-02-14T14:49:29.098Z"}
{"level":"info","message":"update available","timestamp":"2018-02-14T14:49:29.098Z"}
{"level":"info","message":"Downloading update from https://smrt-releases.s3.amazonaws.com/SMRT%20Web%20Setup%202.4.1.exe","timestamp":"2018-02-14T14:49:29.099Z"}
{"level":"error","message":"Error: Error: Cannot download \"https://smrt-releases.s3.amazonaws.com/undefined\", status 404: Not Found\n    at ClientRequest.request.doRequest.response (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\builder-util-runtime\\src\\httpExecutor.ts:153:18)\n    at Object.onceWrapper (events.js:293:19)\n    at emitOne (events.js:96:13)\n    at ClientRequest.emit (events.js:191:7)\n    at URLRequest.ClientRequest.urlRequest.on (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\electron.asar\\browser\\api\\net.js:207:12)\n    at emitOne (events.js:96:13)\n    at URLRequest.emit (events.js:191:7)\nFrom previous event:\n    at CancellationToken.createPromise (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\builder-util-runtime\\src\\CancellationToken.ts:51:5)\n    at C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\electronHttpExecutor.ts:20:44\n    at Generator.next (<anonymous>)\nFrom previous event:\n    at ElectronHttpExecutor.download (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\electronHttpExecutor.js:60:11)\n    at C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\NsisUpdater.ts:85:35\nFrom previous event:\n    at NsisUpdater.doDownloadUpdate (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\NsisUpdater.js:167:11)\n    at C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\AppUpdater.ts:301:25\n    at Generator.next (<anonymous>)\nFrom previous event:\n    at NsisUpdater.downloadUpdate (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\AppUpdater.js:358:11)\n    at C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\AppUpdater.ts:276:49\nFrom previous event:\n    at NsisUpdater.doCheckForUpdates (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\AppUpdater.js:329:11)\n    at C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\AppUpdater.ts:222:25\n    at Generator.next (<anonymous>)\n    at runCallback (timers.js:672:20)\n    at tryOnImmediate (timers.js:645:5)\n    at processImmediate [as _immediateCallback] (timers.js:617:5)\nFrom previous event:\n    at NsisUpdater._checkForUpdates (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\AppUpdater.js:282:11)\n    at NsisUpdater.checkForUpdates (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\AppUpdater.ts:166:35)\n    at Timeout.startLookup [as _onTimeout] (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\webpack:\\src\\main\\plugins\\AutoUpdatePlugin.js:44:25)\n    at ontimeout (timers.js:386:14)\n    at tryOnTimeout (timers.js:250:5)\n    at Timer.listOnTimeout (timers.js:214:5)","timestamp":"2018-02-14T14:49:30.674Z"}
{"level":"error","message":"Error: Cannot download \"https://smrt-releases.s3.amazonaws.com/undefined\", status 404: Not Found\n    at ClientRequest.request.doRequest.response (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\builder-util-runtime\\src\\httpExecutor.ts:153:18)\n    at Object.onceWrapper (events.js:293:19)\n    at emitOne (events.js:96:13)\n    at ClientRequest.emit (events.js:191:7)\n    at URLRequest.ClientRequest.urlRequest.on (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\electron.asar\\browser\\api\\net.js:207:12)\n    at emitOne (events.js:96:13)\n    at URLRequest.emit (events.js:191:7)\nFrom previous event:\n    at CancellationToken.createPromise (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\builder-util-runtime\\src\\CancellationToken.ts:51:5)\n    at C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\electronHttpExecutor.ts:20:44\n    at Generator.next (<anonymous>)\nFrom previous event:\n    at ElectronHttpExecutor.download (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\electronHttpExecutor.js:60:11)\n    at C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\NsisUpdater.ts:85:35\nFrom previous event:\n    at NsisUpdater.doDownloadUpdate (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\NsisUpdater.js:167:11)\n    at C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\AppUpdater.ts:301:25\n    at Generator.next (<anonymous>)\nFrom previous event:\n    at NsisUpdater.downloadUpdate (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\AppUpdater.js:358:11)\n    at C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\AppUpdater.ts:276:49\nFrom previous event:\n    at NsisUpdater.doCheckForUpdates (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\AppUpdater.js:329:11)\n    at C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\AppUpdater.ts:222:25\n    at Generator.next (<anonymous>)\n    at runCallback (timers.js:672:20)\n    at tryOnImmediate (timers.js:645:5)\n    at processImmediate [as _immediateCallback] (timers.js:617:5)\nFrom previous event:\n    at NsisUpdater._checkForUpdates (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\AppUpdater.js:282:11)\n    at NsisUpdater.checkForUpdates (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\AppUpdater.ts:166:35)\n    at Timeout.startLookup [as _onTimeout] (C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\webpack:\\src\\main\\plugins\\AutoUpdatePlugin.js:44:25)\n    at ontimeout (timers.js:386:14)\n    at tryOnTimeout (timers.js:250:5)\n    at Timer.listOnTimeout (timers.js:214:5) 'Error: Cannot download \"https://smrt-releases.s3.amazonaws.com/undefined\", status 404: Not Found\\n    at ClientRequest.request.doRequest.response (C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\app.asar\\\\node_modules\\\\builder-util-runtime\\\\src\\\\httpExecutor.ts:153:18)\\n    at Object.onceWrapper (events.js:293:19)\\n    at emitOne (events.js:96:13)\\n    at ClientRequest.emit (events.js:191:7)\\n    at URLRequest.ClientRequest.urlRequest.on (C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\electron.asar\\\\browser\\\\api\\\\net.js:207:12)\\n    at emitOne (events.js:96:13)\\n    at URLRequest.emit (events.js:191:7)\\nFrom previous event:\\n    at CancellationToken.createPromise (C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\app.asar\\\\node_modules\\\\builder-util-runtime\\\\src\\\\CancellationToken.ts:51:5)\\n    at C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\app.asar\\\\node_modules\\\\electron-updater\\\\src\\\\electronHttpExecutor.ts:20:44\\n    at Generator.next (<anonymous>)\\nFrom previous event:\\n    at ElectronHttpExecutor.download (C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\app.asar\\\\node_modules\\\\electron-updater\\\\out\\\\electronHttpExecutor.js:60:11)\\n    at C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\app.asar\\\\node_modules\\\\electron-updater\\\\src\\\\NsisUpdater.ts:85:35\\nFrom previous event:\\n    at NsisUpdater.doDownloadUpdate (C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\app.asar\\\\node_modules\\\\electron-updater\\\\out\\\\NsisUpdater.js:167:11)\\n    at C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\app.asar\\\\node_modules\\\\electron-updater\\\\src\\\\AppUpdater.ts:301:25\\n    at Generator.next (<anonymous>)\\nFrom previous event:\\n    at NsisUpdater.downloadUpdate (C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\app.asar\\\\node_modules\\\\electron-updater\\\\out\\\\AppUpdater.js:358:11)\\n    at C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\app.asar\\\\node_modules\\\\electron-updater\\\\src\\\\AppUpdater.ts:276:49\\nFrom previous event:\\n    at NsisUpdater.doCheckForUpdates (C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\app.asar\\\\node_modules\\\\electron-updater\\\\out\\\\AppUpdater.js:329:11)\\n    at C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\app.asar\\\\node_modules\\\\electron-updater\\\\src\\\\AppUpdater.ts:222:25\\n    at Generator.next (<anonymous>)\\n    at runCallback (timers.js:672:20)\\n    at tryOnImmediate (timers.js:645:5)\\n    at processImmediate [as _immediateCallback] (timers.js:617:5)\\nFrom previous event:\\n    at NsisUpdater._checkForUpdates (C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\app.asar\\\\node_modules\\\\electron-updater\\\\out\\\\AppUpdater.js:282:11)\\n    at NsisUpdater.checkForUpdates (C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\app.asar\\\\node_modules\\\\electron-updater\\\\src\\\\AppUpdater.ts:166:35)\\n    at Timeout.startLookup [as _onTimeout] (C:\\\\Users\\\\MpUser\\\\AppData\\\\Local\\\\Programs\\\\smrt-systems\\\\resources\\\\app.asar\\\\webpack:\\\\src\\\\main\\\\plugins\\\\AutoUpdatePlugin.js:44:25)\\n    at ontimeout (timers.js:386:14)\\n    at tryOnTimeout (timers.js:250:5)\\n    at Timer.listOnTimeout (timers.js:214:5)'","timestamp":"2018-02-14T14:49:30.675Z"}
{"message":"Cannot download \"https://smrt-releases.s3.amazonaws.com/undefined\", status 404: Not Found","errorClass":"Error","stacktrace":[{"file":"node_modules\\builder-util-runtime\\src\\httpExecutor.ts","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\builder-util-runtime\\src\\httpExecutor.ts","method":"response","lineNumber":153,"columnNumber":18},{"file":"events.js","path":"events.js","method":"onceWrapper","lineNumber":293,"columnNumber":19},{"file":"events.js","path":"events.js","method":"emitOne","lineNumber":96,"columnNumber":13},{"file":"events.js","path":"events.js","method":"emit","lineNumber":191,"columnNumber":7},{"file":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\electron.asar\\browser\\api\\net.js","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\electron.asar\\browser\\api\\net.js","method":"on","lineNumber":207,"columnNumber":12},{"file":"events.js","path":"events.js","method":"emitOne","lineNumber":96,"columnNumber":13},{"file":"events.js","path":"events.js","method":"emit","lineNumber":191,"columnNumber":7},{"file":"node_modules\\builder-util-runtime\\src\\CancellationToken.ts","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\builder-util-runtime\\src\\CancellationToken.ts","method":"createPromise","lineNumber":51,"columnNumber":5},{"file":"node_modules\\electron-updater\\src\\electronHttpExecutor.ts","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\electronHttpExecutor.ts","method":"none","lineNumber":20,"columnNumber":44},{"file":null,"path":null,"method":"next","lineNumber":null,"columnNumber":null},{"file":"node_modules\\electron-updater\\out\\electronHttpExecutor.js","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\electronHttpExecutor.js","method":"download","lineNumber":60,"columnNumber":11},{"file":"node_modules\\electron-updater\\src\\NsisUpdater.ts","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\NsisUpdater.ts","method":"none","lineNumber":85,"columnNumber":35},{"file":"node_modules\\electron-updater\\out\\NsisUpdater.js","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\NsisUpdater.js","method":"doDownloadUpdate","lineNumber":167,"columnNumber":11},{"file":"node_modules\\electron-updater\\src\\AppUpdater.ts","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\AppUpdater.ts","method":"none","lineNumber":301,"columnNumber":25},{"file":null,"path":null,"method":"next","lineNumber":null,"columnNumber":null},{"file":"node_modules\\electron-updater\\out\\AppUpdater.js","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\AppUpdater.js","method":"downloadUpdate","lineNumber":358,"columnNumber":11},{"file":"node_modules\\electron-updater\\src\\AppUpdater.ts","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\AppUpdater.ts","method":"none","lineNumber":276,"columnNumber":49},{"file":"node_modules\\electron-updater\\out\\AppUpdater.js","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\AppUpdater.js","method":"doCheckForUpdates","lineNumber":329,"columnNumber":11},{"file":"node_modules\\electron-updater\\src\\AppUpdater.ts","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\AppUpdater.ts","method":"none","lineNumber":222,"columnNumber":25},{"file":null,"path":null,"method":"next","lineNumber":null,"columnNumber":null},{"file":"timers.js","path":"timers.js","method":"runCallback","lineNumber":672,"columnNumber":20},{"file":"timers.js","path":"timers.js","method":"tryOnImmediate","lineNumber":645,"columnNumber":5},{"file":"timers.js","path":"timers.js","method":"processImmediate [as _immediateCallback]","lineNumber":617,"columnNumber":5},{"file":"node_modules\\electron-updater\\out\\AppUpdater.js","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\out\\AppUpdater.js","method":"_checkForUpdates","lineNumber":282,"columnNumber":11},{"file":"node_modules\\electron-updater\\src\\AppUpdater.ts","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\node_modules\\electron-updater\\src\\AppUpdater.ts","method":"checkForUpdates","lineNumber":166,"columnNumber":35},{"file":"webpack:\\src\\main\\plugins\\AutoUpdatePlugin.js","path":"C:\\Users\\MpUser\\AppData\\Local\\Programs\\smrt-systems\\resources\\app.asar\\webpack:\\src\\main\\plugins\\AutoUpdatePlugin.js","method":"startLookup [as _onTimeout]","lineNumber":44,"columnNumber":25,"inProject":true},{"file":"timers.js","path":"timers.js","method":"ontimeout","lineNumber":386,"columnNumber":14},{"file":"timers.js","path":"timers.js","method":"tryOnTimeout","lineNumber":250,"columnNumber":5},{"file":"timers.js","path":"timers.js","method":"listOnTimeout","lineNumber":214,"columnNumber":5}],"level":"error","timestamp":"2018-02-14T14:49:30.680Z"}

Also, here's my electron-updater implementation/class that outputs the logs you see. The code is the same in the old version of my app and the new one that I'm trying to update to.

import { autoUpdater } from 'electron-updater';
import winston from 'winston';

import NativeClientPlugin from './NativeClientPlugin';


const QUIT_AND_INSTALL = 'quitAndUpdate';
const UPDATE_READY = 'updateReady';
const POLL_INTERVAL = 1000 * 60 * 10;

const NOTIFY_CLIENT_WAIT_TIME = 30000;

export default class AutoUpdatePlugin extends NativeClientPlugin {

    constructor(conf) {
        super(conf);
        AutoUpdatePlugin.registerListeners();
        AutoUpdatePlugin.pollUpdates();
    }

    execute = (action) => {
        switch (action) {
            case QUIT_AND_INSTALL:
                return AutoUpdatePlugin.quitAndInstall();
            default:
                return NativeClientPlugin.fail(`No action ${action}`);
        }
    };

    static pollUpdates() {
        AutoUpdatePlugin.startLookup();
        setInterval(AutoUpdatePlugin.startLookup, POLL_INTERVAL);
    }

    static startLookup() {
        if (process.env.NODE_ENV === 'development') {
            winston.info("No update check, Update system disabled in development");
        }
        else{
            winston.info("update check poll");
            autoUpdater.checkForUpdates();
        }

        return NativeClientPlugin.success();
    }

    static quitAndInstall() {
        autoUpdater.quitAndInstall();

        return NativeClientPlugin.success();
    }

    static notifyUpdateReady(...info) {
        winston.info(`update downloaded ${JSON.stringify(info)}`);
        setTimeout(() => {
            winston.info('notifying client of update');
            AutoUpdatePlugin.notify(UPDATE_READY);
        }, NOTIFY_CLIENT_WAIT_TIME);
    }

    static registerListeners() {
        autoUpdater.logger = winston;
        autoUpdater.on('error', winston.error);
        autoUpdater.on('checking-for-update', () => winston.info('looking for update'));
        autoUpdater.on('update-available', () => winston.info('update available'));
        autoUpdater.on('update-not-available', () => winston.info('update not available'));
        autoUpdater.on('update-downloaded', AutoUpdatePlugin.notifyUpdateReady);
    }
}

Here's my build config in package.json. Likewise, this has not changed between current production build and my new build.

  "build": {
    "appId": "com.smrtsystems.desktopapp",
    "buildDependenciesFromSource": true,
    "nsis": {
      "oneClick": true,
      "runAfterFinish": true,
      "deleteAppDataOnUninstall": true,
      "createDesktopShortcut": true
    },
    "win": {
      "certificateFile": "certificates/SmrtElectronCodeSigning.pfx",
      "certificatePassword": "truncatedforgithub"
    },
    "publish": {
      "provider": "s3",
      "bucket": "smrt-releases",
      "acl": null
    }
  }

Here's my publish command (npm run publish):

cross-env NODE_ENV=production npm run build-preload && electron-webpack --env.minify=false && electron-builder --windows nsis-web --ia32 --x64 --publish always

Here's the final output of the publish command, uploading to S3 successfully:

  • uploading       file=SMRT Web Setup 2.4.3.exe provider=S3
    [====================] 100% 0.0s | SMRT Web Setup 2.4.3.exe to S3
  • uploaded        provider=S3 file=SMRT Web Setup 2.4.3.exe bucket=smrt-releases
  • uploading       file=latest.yml provider=S3
  • uploaded        provider=S3 file=latest.yml bucket=smrt-releases
@baversjo baversjo changed the title Nsis app from fall 2017 (2.10.0) won't update Nsis app from fall 2017 (electron-updater 2.10.0) won't update to new version Feb 14, 2018
@baversjo
Copy link
Author

baversjo commented Feb 15, 2018

I want to add, that it can be proven that this is a compatibility problem with a old version of electron-updater / electron builder. Because updates work fine when trying to update an app from the current version of electron-updater (2.20.2) to the current version of electron-builder (20.0.4), as can be seen in below log:

{"level":"info","message":"Found version 2.4.3 (url: SMRT Web Setup 2.4.3.exe)","timestamp":"2018-02-15T10:05:12.050Z"}
{"level":"info","message":"update available","timestamp":"2018-02-15T10:05:12.050Z"}
{"level":"info","message":"Downloading update from SMRT Web Setup 2.4.3.exe","timestamp":"2018-02-15T10:05:12.052Z"}
{"level":"info","message":"File has 331 changed blocks","timestamp":"2018-02-15T10:05:14.427Z"}
{"level":"info","message":"Full: 47,806.78 KB, To download: 6,864.93 KB (14%)","timestamp":"2018-02-15T10:05:14.431Z"}
{"level":"info","message":"Differential download: https://smrt-releases.s3.amazonaws.com/smrt-systems-2.4.3-x64.nsis.7z","timestamp":"2018-02-15T10:05:14.435Z"}
{"level":"info","message":"New version 2.4.3 has been downloaded to C:\\Users\\Mowllan\\AppData\\Local\\Temp\\up-QmtQWe\\SMRT Web Setup 2.4.3.exe","timestamp":"2018-02-15T10:05:16.176Z"}
{"level":"info","message":"update downloaded [{\"version\":\"2.4.3\",\"files\":[{\"url\":\"SMRT Web Setup 2.4.3.exe\",\"sha512\":\"EeH6GIq0KQDV8yZGGbYTB3cJSpoBaRy8iJUtYt92fBEakC8ORfhJxRBAtzTwbQ5WxpFTpq9SFdh0/dj0+HiSAA==\"}],\"path\":\"SMRT Web Setup 2.4.3.exe\",\"sha512\":\"EeH6GIq0KQDV8yZGGbYTB3cJSpoBaRy8iJUtYt92fBEakC8ORfhJxRBAtzTwbQ5WxpFTpq9SFdh0/dj0+HiSAA==\",\"packages\":{\"ia32\":{\"size\":42154533,\"sha512\":\"RKJFpUB73t3uUwl1FhAjV6NJpb527TizUDvixySjymGvsd+iuTVSgCTxRR9pwyl6MZD4LrQikjHPm8jr94vgFw==\",\"blockMapSize\":43921,\"path\":\"smrt-systems-2.4.3-ia32.nsis.7z\"},\"x64\":{\"size\":48954140,\"sha512\":\"73NzPpv9SJxSg1HKNIaN7O1DN0xOGQ9L30W+goqFbGoVKV7gz49mDqqzITlVfVqVJCe2DaAnVUJEwQaeTLkbGQ==\",\"blockMapSize\":52006,\"path\":\"smrt-systems-2.4.3-x64.nsis.7z\"}},\"sha2\":\"8567a04b9f42f9958c3fe7f41bf0022175fc8d0af5887d43de562eb65773374e\",\"releaseDate\":\"2018-02-14T17:49:15.454Z\"}]","timestamp":"2018-02-15T10:05:16.177Z"}
{"level":"info","message":"notifying client of update","timestamp":"2018-02-15T10:05:46.178Z"}
{"level":"verbose","message":"AutoUpdatePlugin main window exists updateReady","timestamp":"2018-02-15T10:05:46.178Z"}

@baversjo
Copy link
Author

Lastly, if this is a problem with latest.yml having changed format (I'm just guessing), maybe the file can be manually edited to allow old clients to download the update? I really hope to solve this problem somehow, because I have several hundreds of clients that are failing to download this new client currently.

@develar
Copy link
Member

develar commented Feb 20, 2018

I am sorry for late reply for donated issue.

Please manually edit your latest.yml (duplicate path field as file field in the packageInfo):

version: 2.4.3
files:
  - url: SMRT Web Setup 2.4.3.exe
    sha512: EeH6GIq0KQDV8yZGGbYTB3cJSpoBaRy8iJUtYt92fBEakC8ORfhJxRBAtzTwbQ5WxpFTpq9SFdh0/dj0+HiSAA==
path: SMRT Web Setup 2.4.3.exe
sha512: EeH6GIq0KQDV8yZGGbYTB3cJSpoBaRy8iJUtYt92fBEakC8ORfhJxRBAtzTwbQ5WxpFTpq9SFdh0/dj0+HiSAA==
packages:
  ia32:
    size: 42154533
    sha512: RKJFpUB73t3uUwl1FhAjV6NJpb527TizUDvixySjymGvsd+iuTVSgCTxRR9pwyl6MZD4LrQikjHPm8jr94vgFw==
    blockMapSize: 43921
    path: smrt-systems-2.4.3-ia32.nsis.7z
    file: smrt-systems-2.4.3-ia32.nsis.7z
  x64:
    size: 48954140
    sha512: 73NzPpv9SJxSg1HKNIaN7O1DN0xOGQ9L30W+goqFbGoVKV7gz49mDqqzITlVfVqVJCe2DaAnVUJEwQaeTLkbGQ==
    blockMapSize: 52006
    path: smrt-systems-2.4.3-x64.nsis.7z
    file: smrt-systems-2.4.3-x64.nsis.7z
sha2: 8567a04b9f42f9958c3fe7f41bf0022175fc8d0af5887d43de562eb65773374e
releaseDate: '2018-02-14T17:49:15.454Z'

Upcoming electron-builder will add file field for backward compatibility automatically.

@baversjo
Copy link
Author

Updating latest.yml to have the file entry worked perfectly. Been monitoring the logs on some computers and they updated. Thank you for resolving @develar , we thought our support team was going to have to manually help users update there for a while.

I see some computers having trouble updating though. However I don't think the issue is related, just my integration with autoUpdater that's faulty if I had to guess.

If you look at my code I have autoUpdater.checkForUpdates(); in a 10min setInterval. Maybe I need to cancel the setInterval timer upon receiving a update-available event from the autoUpdater?

What's happening is, I get a Downloading update from https://smrt-releases.s3.amazonaws.com/SMRT%20Web%20Setup%202.4.3.exe log. This is the last log message. Then 10min later, I run checkForUpdates again, which produces another Downloading update from... log message. I believe this could be cancelling the first update download? Meaning if app cannot download and run diff algorithm in 10min it goes in a forever loop?

@baversjo
Copy link
Author

Never mind this is just a loop that it continuously finds that an update is available. Upon reboot of app update succeeds. However maybe it could still be considered a best practice to stop polling upon receiving the update-available event? Or maybe I should stop polling on update-ready as that could be considered more fault tolerant ?

@develar
Copy link
Member

develar commented Feb 20, 2018

I think, better solution is to check updates only when app is started. It depends on your app, of course (e.g. tray app that started on launch, but... even in this case your target OS is Windows, so, machine restarted quite often).

Only in very, very specific cases user needs to update app very often. No need to interrupt user work — checking on app launch is enough. And it leads to superior user experience — just download update (if available), notify user that update will be installed on quit, and nothing more. Recent version of electron-updater has function checkForUpdatesAndNotify(). So, on each launch user has up-to-date app without any efforts.

@baversjo
Copy link
Author

You are right @develar . I've updated my code to run checkForUpdatesAndNotify instead of notifying in my UI, and removed the poller. Thank you for your input. I will keep a look out for your new release with this fix :)

@baversjo
Copy link
Author

baversjo commented Mar 18, 2018

Hey @develar , so as you suggested, we moved to checkForUpdatesAndNotify. It's working great except we're seeing one major issue with it; the install on app exit. Was hoping to get your input on how we can resolve.

Our software is a POS system, and at the end of the day users will sometimes just "shut down the computer" without first quitting our app. If there's an update to be installed, one of three things will happen:

  1. Update will successfully finish before windows shuts down.
  2. Update will not have time to start replacing files before windows shuts down.
  3. Update will have started modifying some files before windows shuts down.

Situation #3 is the only really bad one. It actually generates a lot of support tickets after releasing a new version, where we need to help users reinstall the app. Our users aren't very tech savy.. Sometimes users try to "fix it themselves" and use the MS backup recovery tool which takes them back to an even older version of our app.

I've come up with some potential solutions:

  1. App boot install: Only install update IF an update is ready to install on start of app. So a start of app will instantly quit it and relaunch. I've seen many apps behave in this way. Would this be possible with the current API, if not, would it be possible to develop?
  2. Detect if windows is shutting down, and automatically do not install update.
  3. I've seen some apps "block a shutdown" due to them doing stuff. Maybe we could use the windows APIs to halt/delay a shutdown/reboot if an update is to be installed?

The ideal solution for us, would be on that works on both Windows and OSX. I think that would be solution #1? Given your input, I'm happy to create a new issues better describing this problem. Also, if you see a major development that's needed, we're happy to donate... Also, thank you for a great project.

@develar
Copy link
Member

develar commented Mar 18, 2018

As far I understand, you don't have such issue on macOS?

Yes — the main issue as far I see it is fact that installing to directory is not atomic. Instead of writing new files directly to installation location, we can write new files to a temporary directory and then rename. But in any case it will be not really reliable solution.

a major development

thanks to @MariaDima solution "install update on launch if available" is easy now.

@develar
Copy link
Member

develar commented Mar 18, 2018

@baversjo Filed as #2709

we're happy to donate

Probably you can expect some work on issue next weekend.

@baversjo
Copy link
Author

@develar and @MariaDima , thank you! We haven't launched our app for OSX yet but we're about to in the next weeks. So just trying to find the best update solution for osx as well..
Thank you for the link. Are you saying @MariaDima is currently working on something in relation to new issue #2709 now?

@develar
Copy link
Member

develar commented Mar 18, 2018

So just trying to find the best update solution for osx as well..

Squirrel.Mac is used under the hood. And I doubt that it will have such issue.

Are you saying is currently working on something in relation to new issue #2709 now?

#2474 is merged now. How it is related — ability to reuse downloaded update not only right after exit, but any time later.

@baversjo
Copy link
Author

@develar I see, thanks.

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

Successfully merging a pull request may close this issue.

2 participants