Electron-builder: Auto-Updater: Periodically check for updates

Created on 21 Mar 2019  路  3Comments  路  Source: electron-userland/electron-builder


  • Version: 20.39.0

  • electron-updater version: 4.0.6

  • Target: windows

Hello! I'm trying to set our application to periodically check for updates and not just on application start. Since I didn't find anything like this in the documents or examples, I tried with:

autoUpdater.checkForUpdatesAndNotify();
setInterval(autoUpdater.checkForUpdatesAndNotify, 1000 * 60 * 15);

And the first line works perfectly. Update is downloaded and installed as it should. Great. But when called a second time, from the interval, I get this error:

error: uncaughtException: this.isUpdaterActive is not a function
TypeError: this.isUpdaterActive is not a function
    at Timeout.checkForUpdatesAndNotify [as _onTimeout] (...\resources\app.asar\node_modules\electron-updater\src\AppUpdater.ts:245:15)
    at ontimeout (timers.js:425:11)
    at tryOnTimeout (timers.js:289:5)
    at listOnTimeout (timers.js:252:5)
    at Timer.processTimers (timers.js:212:10) 

So I tried with autoUpdater.checkForUpdates instead. Then I started getting

error: uncaughtException: Cannot read property 'info' of undefined
TypeError: Cannot read property 'info' of undefined
    at Timeout.checkForUpdates [as _onTimeout] (...\resources\app.asar\node_modules\electron-updater\src\AppUpdater.ts:219:18)
    at ontimeout (timers.js:425:11)
    at tryOnTimeout (timers.js:289:5)
    at listOnTimeout (timers.js:252:5)

Am I missing something from the documentation? Am I doing something wrong? Auto updates when they are published is a very important thing for our application.

Most helpful comment

@popod Yes, changing it to

setInterval(() => {
    autoUpdater.checkForUpdatesAndNotify();
}, 1000 * 60 * 15);

worked.

All 3 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@vkolova Have you found a solution ? I'me interested by this tool.

@popod Yes, changing it to

setInterval(() => {
    autoUpdater.checkForUpdatesAndNotify();
}, 1000 * 60 * 15);

worked.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NPellet picture NPellet  路  3Comments

jhg picture jhg  路  3Comments

antonycourtney picture antonycourtney  路  3Comments

talarari picture talarari  路  3Comments

omarkilani picture omarkilani  路  3Comments