-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Downloading update from private GitHub repository — mac support #1370
Comments
I'll also note that trying to use both authentication types will throw the same error. So anytime the header
|
I cannot believe. Auth details in the URL it is bad, should be in the headers. |
Fixed in electron-updater 1.1.0 |
@develar thanks for the quick response and update. After updating to 1.1.0, I'm experiencing the
Again, the manual request through Postman worked correctly, so an invalid token is not the issue. It also looks like the |
@derek-duncan Please try 1.10.1 (sorry, first release was not good). |
@develar Ah! Okay I've installed |
@derek-duncan @develar I believe it happens because "net" module of electron (not HttpExecutor from 'electron-builder-http' package) is used to make api requests. So "Authorization" header isn't omitted for redirected to s3 request. |
@vinogradov-m No, HttpExecutor is used, but for some reasons method BTW, test passed. |
@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. |
@vinogradov-m Thanks a lot! Bingo — our tests uses node http executor, but ElectronHttpExecutor, that is used by production code, simply delegates to |
Our position still remains — we MUST NOT pass token as query param to be sure that it is not logged. |
@AlienHoboken As @vinogradov-m commented, ElectronHttpExecutor uses |
@develar good catch on the token as query param, forgot to move that to header so that's my fault! I am looking into this issue also. I came to the same conclusion as @vinogradov-m. It looks like there is no way to stop electron from following redirects (see electron/electron#8868). So it will follow the redirect and apparently pass on the request headers, which is lame. So our options currently look to be:
Even if electron core does resolve this, then the newest version of electron will become a dependency to use private github autoupdater. I'd suggest implementing https://github.com/request/request instead of How do you think we should proceed? |
I think for now we should use NodeHttpExecutor in the PrivateGitHubProvider. Yes, ElectronHttpExecutor (that uses electron net) has better proxy support. But it is a tradeoff. e.g. instead of but problem is that Yeach :( |
Well, it seems there is a way to modify headers during redirect — https://github.com/electron/electron/blob/master/docs/api/web-request.md#webrequestonbeforesendheadersfilter-listener |
Good find! I think that might be serviceable. Let me test it out and if it works I will submit a PR. |
@develar @AlienHoboken Wouldn't it be better just to add "Authorization" header only to requests to api.github.com if auth token is defined instead of modifying headers during a redirect? I've just checked, it seems to be working. |
@vinogradov-m Looks correct and cool. Except that
Here we should not add
The same difference between Electron and Node HttpExecutor. Please
|
Why the addition of the interface in this 2nd version vinogradov-m@3b0668d? And saving original filename looks ok, there is also this check which was originally used (and develar mentioned): ce1df10#diff-684ec0d65067e3c6a1376172edaf1ca3R44 But saving filename looks cleaner |
@AlienHoboken Unfortunately, I've just tested this solution on Mac and it doesn't work. As I understood, we can't add headers to requests of native updater (electron.autoUpdater) via webRequest of the default session. |
I will look at it when I get some time today, maybe this evening. I will see if I can get it working. Just to understand, @vinogradov-m your solution worked on Windows but not on Mac? |
On macOS link to file is hardcoded in the update file, because Squirrel.Mac doesn't support relative links. You cannot change link in runtime. |
@AlienHoboken have you tested your solution before PR on Mac? |
Well... no one will stop us to start local web server to act as a proxy for stupid Squirrel.Mac. Or we should finally fix Squirrel.Mac. Guys, I hope you will continue to investigate, I don't have time currently for this task. |
@develar no, I don't have code signing certificate for mac so I could not test. Is there a workaround for this? |
Please try as @develar said. Electron updater does not interact with publishing, only applying updates already published. If you're still having issues with publishing after trying electron-builder 15.6.1, consider opening an issue and providing errors you're seeing. |
@AlienHoboken have you made any progress on the squirrel.mac blocker? anything I can do to help? |
Why I don't care about users who want to use private GitHub repo and I don't fix this issue in a short term? Because there are number of existing solutions (yes, server is required) — e.g. https://github.com/kevinphelps/electron-update-server Or you can use https://github.com/GitbookIO/nuts. You can set several publisher — first (generic) will be used for auto-update, second (GitHub) for publishing. |
How this issue can be fixed for mac:
|
@derek-duncan I've been pretty busy this weekend, didn't get time to work a lot on it. But I have a working approach (local web proxy as @develar said) that while not an ideal solution long term will get it working. I'm going to look at Sparkle as well, though. But that's a bigger chore. For the meantime I may just get it working. |
@develar Hi, I am trying to use https://github.com/kevinphelps/electron-update-server for mac autoupdates. But I am struggling. This is my publish setup:
When the GenericProvider tries to fetch the latest version ( When I build locally, I can see in my dist folder that I have a latest-mac.json with the correct proxied url on root level, there is also another latest-mac.json inside a github-folder. Any ideas on how I can publish the proxied version instead of the direct version? EDIT: I am using |
Because Squirrel.Mac doesn't support relative urls. Work on custom proxy (local http server to fix Squirrel.Mac issues) is started. You can expect solution in one week. |
Ok, thank you for the quick response :) |
Fixed in electron-update 2.0.0. Will be announced in the #1167. |
experiencing exactly the same issue it seems like |
Same here, |
@hgbloch, how did you solve the problem? |
@KrzysZG37 sorry I wasn't clear. |
@hgbloch unfortunately, i still got the problem even on S3, which i am currently using (Code signature at URL ... did not pass validation: code object is not signed at all) |
@hgbloch |
@amok it is a bug, @KrzysZG37 I will be more than happy to help, I think you should open a new issue |
electron-updater
I've been debugging
Update download failed. The server sent an invalid response. Try again later.
afterelectron-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 theGET
request I'm using:This request fails, because Github requires query-token authentication over header authentication for octet stream requests. See the error returned:
Anyways, the solution to my postman error was changing the authentication to a query string:
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)The text was updated successfully, but these errors were encountered: