Electron Squirrel Auto Updater The remote server returned an error: (308) Permanent Redirect

92 views Asked by At

I was trying to make an auto-updater for my electron app and used Hazel as the update server, but when I tried this and tested it, following every step on the electron guide, It would always give me these errors in the Squirrel-CheckForUpdate.log file:

[10/12/23 11:54:19] info: FileDownloader: Downloading url: https://cbsh-updater.vercel.app//update/win32/1.0.2/releases?id=bellschedoverlay&localversion=1.0.2&arch=amd64
[10/12/23 11:54:19] warn: IEnableLogger: Failed to download url: https://cbsh-updater.vercel.app//update/win32/1.0.2/releases?id=bellschedoverlay&localversion=1.0.2&arch=amd64: System.Net.WebException: The remote server returned an error: (308) Permanent Redirect.
[10/12/23 11:54:19] info: CheckForUpdateImpl: Download resulted in WebException (returning blank release list): System.Net.WebException: The remote server returned an error: (308) Permanent Redirect.
[10/12/23 11:54:19] fatal: Finished with unhandled exception: System.AggregateException: One or more errors occurred. ---> System.Net.WebException: The remote server returned an error: (308) Permanent Redirect.

These errors come with stacktraces in between, which is why I separated them.

Here is my code:

function checkForUpdates() {
  if (app.isPackaged){
    const server = config.hazelUpdateURL;
    const url = `${server}/update/${process.platform}/${app.getVersion()}`;

    autoUpdater.setFeedURL({ url });

    autoUpdater.checkForUpdates();
    
  }
}


autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {

dialog.showMessageBox({
    type: 'info',
    buttons: ['Restart', 'Later'],
    title: 'Application Update',
    message: process.platform === 'win32' ? releaseNotes : releaseName,
    detail:
      'A new version of the Crooms Bell Schedule has been downloaded. Restart the application to apply the updates.'
  }).then((returnValue) => {
    if (returnValue.response === 0) autoUpdater.quitAndInstall()
  });

})

autoUpdater.on('error', (message) => {
  console.error('There was a problem updating the application');
  console.error(message);
});

checkForUpdates();

I tried the url it failed to download from in a browser, and it downloaded the RELEASES file successfully with the expected content, but does show a 308 status code in the networking tab of devtools.

How do I ignore this error and force it to download the RELEASES file even if it is a redirect?

1

There are 1 answers

0
kone On

Never mind, this issue only happens on my main computer; all other computers I own just auto-update fine.