Downloading update from private GitHub repository — mac support
See original GitHub issueelectron-updater
- Version: 1.9.0
- Target: dmg
I’ve been debugging Update download failed. The server sent an invalid response. Try again later.
after electron-updater
attempts to download from a private GitHub repo. I wanted to confirm the authentication token wasn’t the problem, so I replicated the request in Postman. Here’s the GET
request I’m using:
Url: "https://api.github.com/repos/__OWNER__/__REPO__/releases/assets/__ASSET_ID__"
Headers: {
Accept: "application/octet-stream"
Authorization: __TOKEN__
}
This request fails, because Github requires query-token authentication over header authentication for octet stream requests. See the error returned:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>InvalidArgument</Code>
<Message>Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specified</Message>
<ArgumentName>Authorization</ArgumentName>
<ArgumentValue>token __TOKEN__</ArgumentValue>
<RequestId>88A9E737F583B6C9</RequestId>
<HostId>TqzUjnu1qvKvN8WfyGNt7d0sNXkhF58kH3KsKZu1WCqZALaP4UADqQXl42v6+8NLbkDVueuYLhI=</HostId>
</Error>
Anyways, the solution to my postman error was changing the authentication to a query string:
Url: "https://api.github.com/repos/__OWNER__/__REPO__/releases/assets/__ASSET_ID__?access_token=__TOKEN__"
Headers: {
Accept: "application/octet-stream"
}
The file from the private GitHub repo is then successfully downloaded.
Since this request in Postman worked, I manually made the change in the npm module to see if it fixed the Update download failed. The server sent an invalid response. Try again later.
error. However, the same error message is still returned, and the download fails. I’m stuck for now and need some input on how to proceed. 🤔
Thank you 👍
(btw: I am using placeholder __VARS__
throughout my example code. Their actual values do appear in the error messages)
Issue Analytics
- State:
- Created 7 years ago
- Comments:48 (28 by maintainers)
Top GitHub Comments
@amok it is a bug, After looking at recent changes, about 13 days ago they moved the auth headers removal from PrivateGithubProvider to electronHttpExecuter, or at least it seems like that.
@KrzysZG37 I will be more than happy to help, I think you should open a new issue
@develar I’m sorry, maybe I misunderstood you. I just meant that electron-updater uses ElectronHttpExecutor (which extends HttpExecutor) where method doApiRequest() is overridden, and net module of electron is used to download update packages from github via api requests: https://github.com/electron-userland/electron-builder/blob/master/packages/electron-updater/src/electronHttpExecutor.ts#L40
Anyway, I’m investigating this issue and will do PR if I find an acceptable solution.