Skip to content

autoUpdater does not work when have authenticated proxy #5020

Closed

Description

@MarshallOfSound
  • Electron version: 0.36.7
  • Operating system: Windows

The autoUpdater module in electron does not appear to be attempting to update all my users on windows from 3.0.1 to 3.1.0. It took a clean reinstall of the application on a few computers that I am aware of before it decided there was an update too download.

Upon sniffing out the traffic I could see that an update check request was being sent to fetch the RELEASES file and then didn't attempt to download the obviously available update.

I don't see how it can work for around 80% of users (that number is a guestimate) and not work for the rest.

The update server is here http://update.googleplaymusicdesktopplayer.com/update/{platform}/{version}
The update code is here https://github.com/MarshallOfSound/Google-Play-Music-Desktop-Player-UNOFFICIAL-/blob/master/src/main/features/core/autoUpdater.js

Activity

  1. kevinsawicki commented on Apr 4, 2016

    @kevinsawicki
    Contributor

    What version of squirrel on windows is your installer using?

  2. MarshallOfSound commented on Apr 4, 2016

    @MarshallOfSound
    MemberAuthor

    Whichever version is packaged with grunt-electron-installer version 1.2.3

    I can see that that repository received a major version bump recently to 2.0.0, is that bump at all related to this issue?

  3. kevinsawicki commented on Apr 4, 2016

    @kevinsawicki
    Contributor

    is that bump at all related to this issue?

    No, that major bump was for a new underlying library that was used.

  4. MarshallOfSound commented on Apr 4, 2016

    @MarshallOfSound
    MemberAuthor

    No, that major bump was for a new underlying library that was used.

    Bit of a long shot hope 😆

    I'm trying to find a way to accurately replicate this issue but it appears to be completely random 😢

  5. kevinsawicki commented on Apr 4, 2016

    @kevinsawicki
    Contributor

    Are you able to get the squirrel logs off any of the machines that are experiencing the issue?

  6. MarshallOfSound commented on Apr 4, 2016

    @MarshallOfSound
    MemberAuthor

    I'll grab them as soon as I can make it do this again. Completely uninstalling and reinstalling to replicate is time consuming when there is only a small chance it fails 😄

  7. MarshallOfSound commented on Apr 4, 2016

    @MarshallOfSound
    MemberAuthor

    @kevinsawicki It appears as though there is some release notes parsing error https://gist.github.com/MarshallOfSound/7c6616b032a2499afd56de71186ef451 but then it still (eventually) starts building the full package and my app receives an update notification.

    Still trying to make it not update 😞

    I just pinged all the issues related to this asking for them to upload their squirrel log. I'll ping here if / when I get one

  8. MarshallOfSound commented on Apr 5, 2016

    @MarshallOfSound
    MemberAuthor

    @kevinsawicki I managed to get a log from someone else's PC experiencing this issue.
    https://gist.github.com/rickwastaken/c659c5a9fe75ecb3db274222bf6c288c

    From what I can see they are having really strange DNS issues, which used to happen a lot (as an example MarshallOfSound/Google-Play-Music-Desktop-Player-UNOFFICIAL-#301)

    However when the user accesses update.googleplaymusicdesktopplayer.com in there browser. It resolves the address fine (as seen here

    Any reason why C#'s WebClient wouldn't resolve the name but a browser would?

  9. kevinsawicki commented on Apr 5, 2016

    @kevinsawicki
    Contributor

    Any reason why C#'s WebClient wouldn't resolve the name but a browser would?

    No idea, not sure if @paulcbetts might know 🔦

  10. anaisbetts commented on Apr 5, 2016

    @anaisbetts
    Contributor

    Any reason why C#'s WebClient wouldn't resolve the name but a browser would?

    If it's using an authenticated proxy

  11. MarshallOfSound commented on Apr 5, 2016

    @MarshallOfSound
    MemberAuthor

    @paulcbetts Is there any way around this? Or any way for me to detect that proxy from within electron and tell the user they won't be able to get updates?

  12. baconbrad commented on Apr 5, 2016

    @baconbrad
    Contributor

    Is there any way around this? Or any way for me to detect that proxy from within electron and tell the user they won't be able to get updates?

    @MarshallOfSound There are several NPM packages that let you detect a proxy. Or you could write your own solution in Node.js to detect a proxy. Could you do that without needing changes in Squirrel for Windows? Because there would be cases where someone would want to update via a proxy.

    Ideally I would skip all the above together and either check to see if the file could be reached and notify the user if not or attempt to download the file and notify the user if the download fails. This is how most updaters handle this.

    If none of the above works for you I guess I don't completely understand your case.

  13. anaisbetts commented on Apr 7, 2016

    @anaisbetts
    Contributor

    So, the problem at the end of the day is, if you have an authenticated proxy on Windows, you need to pop UI to prompt for username/passwords at the time of request (i.e. not just in a system settings dialog). This is deeply stupid, but it is what it is.

    To mitigate this, you could download RELEASES and the latest NuPkg file yourself with Chromium (as well as implement the login callback to actually show UI in-app), then point your updater URL to that temp folder. This is deeply obnoxious, but so are proxy servers.

  14. MarshallOfSound commented on Apr 7, 2016

    @MarshallOfSound
    MemberAuthor

    @paulcbetts Out of interest do you know how / if atom handles this problem? Downloading the RELEASES and nupkg files through electron seems a bit silly to me but it seems like I need to somehow bypass a network connection all together so I'm not sure.... 😢

  15. 44 remaining items

  16. FCF-Releases commented on May 21, 2021

    @FCF-Releases

    hi all, everything seems to be working fine for me on this except that it never seems to trigger the autoUpdate.on('update-downloaded') event? Anyone experienced this?

  17. FCF-Releases commented on Feb 5, 2022

    @FCF-Releases

    Fingers crossed someone sees this! I was using this successfully and now it appears to not recognize the feedURL or at least autoUpdater.checkForUpdates() does not trigger anymore. Has anything changed in the AutoUpdater for electron?

  18. sploders101 commented on Feb 5, 2022

    @sploders101

    Fingers crossed someone sees this! I was using this successfully and now it appears to not recognize the feedURL or at least autoUpdater.checkForUpdates() does not trigger anymore. Has anything changed in the AutoUpdater for electron?

    Are you using the built-in updater the npm module?

    Unfortunately, I don't believe the built-in updater has supported this for quite some time, which is why I posted the in-app HTTP proxy method above. The updater runs outside the JavaScript context, so unless they add support for this, I don't think it's going to work. Someone please correct me if I'm wrong.

  19. christianblandford commented on Feb 16, 2022

    @christianblandford

    I created electron-github-autoupdater to solve this problem. It's a custom autoUpdater that works pretty much the same, but accepts a config object including a GH user token. More information in the readme.

    I've tested this on the latest versions of electron-forge, but I believe forge is electron 14, so it may not be compatible on v16+. Also, I have only tested on windows, I would very much appreciate a Mac user giving it a go.

  20. qiqetes commented on Jun 28, 2022

    @qiqetes

    I'm trying to Manually handle updates.

    I download the update from s3 bucket whenever there's an available update. And then I create a feed.json file with the format:

    {"url": "file:///var/temp/aofsdjaodsijf/update.zip"}

    Then I set the

    autoUpdater.setFeedUrl("file:///var/temp/aofsdjaodsijf/feed.json");
    autoUpdater.checkUpdates();

    But I get this error:
    Error: Could not locate update bundle for com.github.Electron within file:///Users/X/Library/Caches/com.github.Electron.ShipIt/update.SrmZwAy/ that looks nothing like the "url" that I passed...

    I'm very stuck on this, some help would be very appreciated.

  21. zschreur commented on Jun 28, 2022

    @zschreur

    @qiqetes Using the url package could help ensure the URL is properly formatted.

    const URL = require('url');
    
    ...
    
    const createFeedUrlFile = async (updateCache, zipFile) => {
       const json = {
          url: Url.pathToFileURL(zipFile).href
       }
    
       const feedUrlFile = path.join(updateCache, 'feed.json');
    
       await fs.promises.writeFile(feedUrlFile, JSON.stringify(json));
    
       return feedUrlFile;
    }
    
    ...
    
    autoUpdater.setFeedURL({
       url: Url.pathToFileURL(feedUrlFile).href
    });
    
  22. qiqetes commented on Jun 28, 2022

    @qiqetes

    Thanks for the reply. Seems like the urls are fine. (tried with your method, same error is thrown).
    image

  23. emalei commented on Oct 17, 2022

    @emalei

    Thanks for the reply. Seems like the urls are fine. (tried with your method, same error is thrown). image

    Have you solved this problem

  24. saibhavateja1 commented on Jan 13, 2023

    @saibhavateja1

    I'm trying to Manually handle updates.

    I download the update from s3 bucket whenever there's an available update. And then I create a feed.json file with the format:

    {"url": "file:///var/temp/aofsdjaodsijf/update.zip"}

    Then I set the

    autoUpdater.setFeedUrl("file:///var/temp/aofsdjaodsijf/feed.json");
    autoUpdater.checkUpdates();

    But I get this error: Error: Could not locate update bundle for com.github.Electron within file:///Users/X/Library/Caches/com.github.Electron.ShipIt/update.SrmZwAy/ that looks nothing like the "url" that I passed...

    I'm very stuck on this, some help would be very appreciated.

    @qiqetes @emalei Did you figure out a way to solve this? Looks like autoUpdater creates Users/X/Library/Caches/*/update. before downloading. Since we are skipping that part and doing it ourselves, this file/dir seems to be missing.

    @joshuapinter How did you get this to work?

  25. qiqetes commented on Jan 13, 2023

    @qiqetes

    I'm trying to Manually handle updates.
    I download the update from s3 bucket whenever there's an available update. And then I create a feed.json file with the format:

    {"url": "file:///var/temp/aofsdjaodsijf/update.zip"}

    Then I set the

    autoUpdater.setFeedUrl("file:///var/temp/aofsdjaodsijf/feed.json");
    autoUpdater.checkUpdates();

    But I get this error: Error: Could not locate update bundle for com.github.Electron within file:///Users/X/Library/Caches/com.github.Electron.ShipIt/update.SrmZwAy/ that looks nothing like the "url" that I passed...
    I'm very stuck on this, some help would be very appreciated.

    @qiqetes @emalei Did you figure out a way to solve this? Looks like autoUpdater creates Users/X/Library/Caches/*/update. before downloading. Since we are skipping that part and doing it ourselves, this file/dir seems to be missing.

    @joshuapinter How did you get this to work?

      const tempPath = path.join(app.getPath("temp"), "updateVersion");
    
      const setAutoUpdaterMac = () => {
        // We need to manually create a feed.json file with a `url` key that points to our local `.zip` update file.
        const json = {
          url: url.pathToFileURL(path.join(tempPath, "update.zip")).href,
        };
    
        fs.writeFileSync(tempPath + "/feed.json", JSON.stringify(json));
        console.log("file://" + tempPath + "/feed.json");
    
        autoUpdater.setFeedURL({
          url: url.pathToFileURL(path.join(tempPath, "feed.json")).href,
        });
         autoUpdater.checkForUpdates();
      };

    I don't remember it too much, what I have now and it's working is that piece of code.

  26. saibhavateja1 commented on Jan 13, 2023

    @saibhavateja1

    @qiqetes Thank you for the snippet. Do you mind sharing which version of electron you are using today?
    Also is the autoUpdater from electron module?

  27. qiqetes commented on Jan 13, 2023

    @qiqetes

    @qiqetes Thank you for the snippet. Do you mind sharing which version of electron you are using today? Also is the autoUpdater from electron module?

    Latest version, and yes, autoUpdater comes from the electron module;

  28. saibhavateja1 commented on Jan 18, 2023

    @saibhavateja1

    @qiqetes Thank you. The issue's resolved now. The reason is – I am downloading a .dmg and feeding that to the autoUpdater when instead I should be feeding a zip file of .app

    One other thing that I would like to bring up is, I am being prompted with a message saying "Application is downloaded from the internet. Are you sure you want to open it?" This is happening every time an update is downloaded and installed. Any idea why this happens?

  29. 0xvgd commented on Jan 28, 2023

    @0xvgd

    Is nupkg file still required for auto update on Windows?
    I found squirrel.windows, which is used for generating nupkg file, is deprecated and can't see the latest update from its repository.
    On the other hand, I found squirrel.windows is still a solution to auto update an electron app on Windows.
    https://www.electronjs.org/docs/latest/api/auto-updater#windows
    What is the best way to implement auto update on windows?
    @joshuapinter @scottrippey

  30. lockiechen commented on Oct 27, 2023

    @lockiechen

    how can i add query token when download the windows pkg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions