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][[0;37minfo[0m]: Start update checking. [02.06 23:27:15.683][Electron][[0;37minfo[0m]: Checking for update [02.06 23:27:15.683][Electron][[0;37minfo[0m]: Checking for update… [02.06 23:27:17.287][Electron][[0;37minfo[0m]: Found version 0.3.12 (url: MyApp-0.3.12.dmg) [02.06 23:27:17.288][Electron][[0;37minfo[0m]: Update available. [02.06 23:27:17.290][Electron][[0;37minfo[0m]: Downloading update from MyApp-0.3.12.dmg [02.06 23:27:17.372][Electron][[0;37minfo[0m]: / requested [02.06 23:27:17.380][Electron][[0;37minfo[0m]: /app.zip requested [02.06 23:27:17.940][Electron][[0;33mwarning[0m]: Error: Update download failed. The server sent an invalid response. Try again later. [02.06 23:27:17.940][Electron][[0;31merror[0m]: Error: Error: Update download failed. The server sent an invalid response. Try again later. [02.06 23:27:17.942][Electron][[0;37minfo[0m]: 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][[0;31merror[0m]: 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][[0;37minfo[0m]: 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][[0;37minfo[0m]: 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:
- Created 6 years ago
- Comments:11 (1 by maintainers)
Top GitHub Comments
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.
@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:
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.