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.

Private github unable to update

See original GitHub issue
  • Version of builder: 19.56.0
  • Version of updater: 2.18.2
  • Target: mac, win, linux

Hello,

I have some troubles with updating.

Here is my build configuration (as example for mac-target):

appId : 'com.xx.de', productName : 'myapp', copyright : 'Copyright © 2018 year xx', directories :{ output : 'dist' }, publish: [{ provider : "github", owner : "owner", repo : "myapp", private : true, token : GIT_TOKEN }], npmRebuild : true

And here, a way how I’m trying update it:

`
const electronUpdater = require(“electron-updater”);

    _autoUpdater = electronUpdater.autoUpdater;

    _autoUpdater.setFeedURL({
        provider        : "github",
        owner           : "owner",
        repo            : "myapp",
        token           : GIT_TOKEN,
        private         : true
    });
    _autoUpdater.checkForUpdates();`

In addition I’ve include token into env and headers:

_autoUpdater.requestHeaders = { “PRIVATE-TOKEN”: GIT_TOKEN }; process.env.GH_TOKEN = GIT_TOKEN;

Updates are detected, but I have next error:

Error: Cannot download “https://api.github.com/repos/owner/MyApp/releases/assets/6124771”: Error: Cannot download “https://api.github.com/repos/owner/MyApp/releases/assets/6124771”, status 400: Bad Request at /Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/MacUpdater.ts:74:22

Full logs:

[02.06 23:27:15.596][Electron][info]: Start update checking. [02.06 23:27:15.683][Electron][info]: Checking for update [02.06 23:27:15.683][Electron][info]: Checking for update… [02.06 23:27:17.287][Electron][info]: Found version 0.3.12 (url: MyApp-0.3.12.dmg) [02.06 23:27:17.288][Electron][info]: Update available. [02.06 23:27:17.290][Electron][info]: Downloading update from MyApp-0.3.12.dmg [02.06 23:27:17.372][Electron][info]: / requested [02.06 23:27:17.380][Electron][info]: /app.zip requested [02.06 23:27:17.940][Electron][warning]: Error: Update download failed. The server sent an invalid response. Try again later. [02.06 23:27:17.940][Electron][error]: Error: Error: Update download failed. The server sent an invalid response. Try again later. [02.06 23:27:17.942][Electron][info]: Error in auto-updater. Error: { Error: Update download failed. The server sent an invalid response. Try again later. code: 5, domain: ‘SQRLUpdaterErrorDomain’ } [02.06 23:27:17.944][Electron][error]: Error: Error: Cannot download “https://api.github.com/repos/owner/MyApp/releases/assets/6124771”: Error: Cannot download “https://api.github.com/repos/owner/MyApp/releases/assets/6124771”, status 400: Bad Request at /Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/MacUpdater.ts:74:22 at ClientRequest.downloadRequest.httpExecutor.doRequest.downloadResponse (/Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/MacUpdater.ts:101:11) at emitOne (events.js:96:13) at ClientRequest.emit (events.js:191:7) at URLRequest.ClientRequest.urlRequest.on (/Applications/MyApp.app/Contents/Resources/electron.asar/browser/api/net.js:207:12) at emitOne (events.js:96:13) at URLRequest.emit (events.js:191:7) From previous event: at /Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/MacUpdater.ts:44:12 From previous event: at MacUpdater.doDownloadUpdate (/Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/out/MacUpdater.js:127:11) at /Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:340:25 at Generator.next (<anonymous>) From previous event: at MacUpdater.downloadUpdate (/Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/out/AppUpdater.js:382:11) at /Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:316:49 From previous event: at MacUpdater.doCheckForUpdates (/Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/out/AppUpdater.js:353:11) at /Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:264:25 at Generator.next (<anonymous>) at runCallback (timers.js:672:20) at tryOnImmediate (timers.js:645:5) at processImmediate [as _immediateCallback] (timers.js:617:5) From previous event: at MacUpdater._checkForUpdates (/Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/out/AppUpdater.js:307:11) at MacUpdater.checkForUpdates (/Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:213:35) at Updater.check (/Applications/MyApp.app/Contents/Resources/app.asar/electron/application.updater.js:80:34) at APICommands.checkUpdates (/Applications/MyApp.app/Contents/Resources/app.asar/server/libs/api.commands.js:218:17) at APIProcessor.proceed (/Applications/MyApp.app/Contents/Resources/app.asar/server/libs/api.processor.js:55:45) at getPOSTData (/Applications/MyApp.app/Contents/Resources/app.asar/server/libs/server.js:98:35) at IncomingMessage.request.on (/Applications/MyApp.app/Contents/Resources/app.asar/server/libs/server.js:139:13) at emitNone (events.js:86:13) at IncomingMessage.emit (events.js:188:7) at endReadableNT (_stream_readable.js:975:12) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickCallback (internal/process/next_tick.js:104:9) [02.06 23:27:17.944][Electron][info]: Error in auto-updater. Error: Error: Cannot download “https://api.github.com/repos/owner/MyApp/releases/assets/6124771”: Error: Cannot download “https://api.github.com/repos/owner/MyApp/releases/assets/6124771”, status 400: Bad Request at /Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/MacUpdater.ts:74:22 at ClientRequest.downloadRequest.httpExecutor.doRequest.downloadResponse (/Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/MacUpdater.ts:101:11) at emitOne (events.js:96:13) at ClientRequest.emit (events.js:191:7) at URLRequest.ClientRequest.urlRequest.on (/Applications/MyApp.app/Contents/Resources/electron.asar/browser/api/net.js:207:12) at emitOne (events.js:96:13) at URLRequest.emit (events.js:191:7) From previous event: at /Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/MacUpdater.ts:44:12 From previous event: at MacUpdater.doDownloadUpdate (/Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/out/MacUpdater.js:127:11) at /Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:340:25 at Generator.next (<anonymous>) From previous event: at MacUpdater.downloadUpdate (/Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/out/AppUpdater.js:382:11) at /Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:316:49 From previous event: at MacUpdater.doCheckForUpdates (/Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/out/AppUpdater.js:353:11) at /Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:264:25 at Generator.next (<anonymous>) at runCallback (timers.js:672:20) at tryOnImmediate (timers.js:645:5) at processImmediate [as _immediateCallback] (timers.js:617:5) From previous event: at MacUpdater._checkForUpdates (/Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/out/AppUpdater.js:307:11) at MacUpdater.checkForUpdates (/Applications/MyApp.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:213:35) at Updater.check (/Applications/MyApp.app/Contents/Resources/app.asar/electron/application.updater.js:80:34) at APICommands.checkUpdates (/Applications/MyApp.app/Contents/Resources/app.asar/server/libs/api.commands.js:218:17) at APIProcessor.proceed (/Applications/MyApp.app/Contents/Resources/app.asar/server/libs/api.processor.js:55:45) at getPOSTData (/Applications/MyApp.app/Contents/Resources/app.asar/server/libs/server.js:98:35) at IncomingMessage.request.on (/Applications/MyApp.app/Contents/Resources/app.asar/server/libs/server.js:139:13) at emitNone (events.js:86:13) at IncomingMessage.emit (events.js:188:7) at endReadableNT (_stream_readable.js:975:12) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickCallback (internal/process/next_tick.js:104:9) [02.06 23:27:48.348][Electron][info]: Proxy server for native Squirrel.Mac is closed (was started to download https://api.github.com/repos/owner/MyApp/releases/assets/6124771)

Publishing process is ok. Solution is built and published as well. But issue comes with updating process.

As far as I see “updater” have successful access to repo, because it can detect new version, but it fails with attempt to download it.

What I do wrong? Many thanks in advance for your support.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
neyko5commented, Feb 8, 2018

I am experiencing the same problem on the newest version of updater (2.20.1.). Inspecting code a bit I discovered that updater at the point of crash expects ‘files’ array, but GitHub API returns ‘assets’. Not 100% this is the cause of problem here.

For me it worked when I downgraded to version of updater (2.14.0 - Nov 2017). This is not necessarily the latest version that works as I did not try them all.

1reaction
DmitryAstafyevcommented, Oct 8, 2020

@pedro-surf Hi. You know, I’ve come to thought, that updating software from a private source (private github account) is a weak idea as itself.

If your software is private, and you would like to keep it private, this is a question of infrastructure more. I mean, such software should work as the normal standard software, but access limitation should be under the control of the network.

In any way, in our solution (which is already public), we’ve found as the best way - own simple implementation of update workflow. It’s really easy to implement and in general, the workflow looks like:

  1. application checks gihub releases for updates
  2. if update available - application downloads it into some temp-folder
  3. application shows some dialog to ask user about update
  4. application starts updater* and close itself

updater - simple and small application, which will replace files of your application with updated version from temp-folder

And this is it.

Why we switched to our own implementation? Because it’s really not hard to implement and get rid of one more dependency on solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to update npm dependency that is a private github ...
There is no way for a repo in github to update an npm dependency that is a private github package. When using node...
Read more >
Unable to update dependency from private GitHub repository
Because projectB is a private repository, a SSH key is required and without additional configuration tools such as go get and dep fail....
Read more >
not able to update a plugin from a private GitHub repo since ...
I have a "Personal Access Token" for that private repo entered into GHU Settings. The fact GHU correctly recognizes there is an update...
Read more >
Setting repository visibility - GitHub Docs
Under "Danger Zone", to the right of to "Change repository visibility", click Change visibility. Change visibility button. Select a visibility. Dialog of ...
Read more >
Unable to update Personal Access Tokens for GitHub pull ...
I had some GitHub → Gitea pull mirrors working, but I need to rotate the GitHub token. I could not find any documentation...
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