question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I’m having hard time implementing auto-updates in one of my electron app. I have set it up nuts on heroku successfully and it’s working fine but I don’t know how to implement this in my electron app’s autoupdater api. Adding this in my main.js does nothing-

var app = require('app');
var os = require('os');
var autoUpdater = require('electron').autoUpdater;

var platform = os.platform() + '_' + os.arch();  // usually returns darwin_64
var version = app.getVersion();

autoUpdater.setFeedURL('http://zulipdesktop.herokuapp.com/update/'+platform+'/'+version);

It would be awesome if you someone can point me to a working example.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:28

github_iconTop GitHub Comments

2reactions
GitFlipcommented, Apr 25, 2018

I figured out how to enable and view logging in heroku for when it launches nuts. Turns out there is an issue with connecting to GitHub, although I’m not sure what just yet. The repo I’m connecting to is private. Did either of you run into this issue:

2018-04-25T20:36:28.127988+00:00 heroku[web.1]: Starting process with command `npm start`
2018-04-25T20:36:31.564677+00:00 app[web.1]: 
2018-04-25T20:36:31.564699+00:00 app[web.1]: > nuts-serve@3.1.1 start /app
2018-04-25T20:36:31.564701+00:00 app[web.1]: > node bin/web.js
2018-04-25T20:36:31.564703+00:00 app[web.1]: 
2018-04-25T20:36:34.072761+00:00 app[web.1]: GitHubError: Not Found
2018-04-25T20:36:34.072782+00:00 app[web.1]:     at GitHub.onResponse (/app/node_modules/octocat/lib/index.js:89:15)
2018-04-25T20:36:34.072784+00:00 app[web.1]:     at GitHub.wrapper [as onResponse] (/app/node_modules/octocat/node_modules/lodash/index.js:3095:19)
2018-04-25T20:36:34.072786+00:00 app[web.1]:     at Request._callback (/app/node_modules/octocat/lib/index.js:126:31)
2018-04-25T20:36:34.072788+00:00 app[web.1]:     at Request.self.callback (/app/node_modules/octocat/node_modules/request/request.js:198:22)
2018-04-25T20:36:34.072790+00:00 app[web.1]:     at emitTwo (events.js:126:13)
2018-04-25T20:36:34.072791+00:00 app[web.1]:     at Request.emit (events.js:214:7)
2018-04-25T20:36:34.072793+00:00 app[web.1]:     at Request.<anonymous> (/app/node_modules/octocat/node_modules/request/request.js:1063:14)
2018-04-25T20:36:34.072795+00:00 app[web.1]:     at emitOne (events.js:121:20)
2018-04-25T20:36:34.072796+00:00 app[web.1]:     at Request.emit (events.js:211:7)
2018-04-25T20:36:34.072798+00:00 app[web.1]:     at IncomingMessage.<anonymous> (/app/node_modules/octocat/node_modules/request/request.js:1009:12)
2018-04-25T20:36:34.126307+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2018-04-25T20:36:34.126851+00:00 app[web.1]: npm ERR! errno 1
2018-04-25T20:36:34.131733+00:00 app[web.1]: npm ERR! nuts-serve@3.1.1 start: `node bin/web.js`
2018-04-25T20:36:34.132003+00:00 app[web.1]: npm ERR! Exit status 1
2018-04-25T20:36:34.132810+00:00 app[web.1]: npm ERR! 
2018-04-25T20:36:34.133093+00:00 app[web.1]: npm ERR! Failed at the nuts-serve@3.1.1 start script.
2018-04-25T20:36:34.133349+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-04-25T20:36:34.175037+00:00 app[web.1]: 
2018-04-25T20:36:34.175455+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-04-25T20:36:34.175714+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2018-04-25T20_36_34_135Z-debug.log

Update: Fixed this issue by changing GITHUB_REPO from the full url path, to just username/repo-name.

To answer my own question… if you navigate to the URL provided by heroku, it should download the latest release of your electron app. It should not say “Application Error”

2reactions
HaNdTriXcommented, Dec 5, 2016

Try adding:

// Log whats happening
autoUpdater.on('error', err => console.error(err))
autoUpdater.on('checking-for-update', () => console.log('checking-for-update'))
autoUpdater.on('update-available', () => console.log('update-available'))
autoUpdater.on('update-not-available', () => console.log('update-not-available'))
autoUpdater.on('update-downloaded', () => console.log('update-downloaded'))

// Ask the user if update is available
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
  dialog.showMessageBox(window, {
    type: 'question',
    buttons: ['Update', 'Cancel'],
    defaultId: 0,
    message: `Version ${releaseName} is available, do you want to install it now?`,
    title: 'Update available'
  }, response => {
    if (response === 0) {
      autoUpdater.quitAndInstall()
    }
  })
})

// Trigger autoUpdater
autoUpdater.checkForUpdates()

http://electron.atom.io/docs/api/auto-updater/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Example Definition & Meaning - Merriam-Webster
an instance (such as a problem to be solved) serving to illustrate a rule or precept or to act as an exercise in...
Read more >
Example Definition & Meaning - Dictionary.com
a pattern or model, as of something to be imitated or avoided: to set a good example. an instance serving for illustration; a...
Read more >
EXAMPLE | definition in the Cambridge English Dictionary
a person or a way of behaving that is considered suitable to be copied: He's a very good example to the rest of...
Read more >
example ​Definitions and Synonyms ​‌‌‌ - Macmillan Dictionary
Definition of EXAMPLE (noun): something that you mention as an explanation; good person or behaviour suitable for copying; phrase in dictionary ...
Read more >
Example definition and meaning | Collins English Dictionary
An example of something is a particular situation, object, or person that shows that what is being claimed is true. The doctors gave...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found