Squirrel / Squirrel.Windows

An installation and update framework for Windows desktop apps
MIT License
7.23k stars 1.02k forks source link

i am facing System.aggregate Exception 81513513 is notvalid string error while checking for update #1833

Closed rizwan92 closed 1 year ago

rizwan92 commented 1 year ago

Squirrel version(s) Which version(s) of the project are you using? electron forge

 "@electron-forge/cli": "^6.0.0-beta.67",
    "@electron-forge/maker-deb": "^6.0.0-beta.67",
    "@electron-forge/maker-dmg": "^6.0.0-beta.67",
    "@electron-forge/maker-rpm": "^6.0.0-beta.67",
    "@electron-forge/maker-squirrel": "^6.0.0-beta.67",
    "@electron-forge/maker-zip": "^6.0.0-beta.67",
    "@electron-forge/publisher-github": "^6.0.0-beta.67",
    "electron": "^21.1.0",
    "electron-builder": "^23.6.0",
    "electron-builder-squirrel-windows": "^23.6.0",

Description Not able to update my squirrel electron application

Steps to recreate

  1. install the .exe file
  2. wait for 6000 seconds the electron checks for an update
  3. then i get this error

Expected behavior it must have updated in the background

Actual behavior its throws an error

Additional information

I have electron.js file

const path = require("path");
const { app, BrowserWindow, ipcMain, autoUpdater } = require("electron");
const isDev = require("electron-is-dev");

if (!isDev) {
  if (require("electron-squirrel-startup")) return app.quit();
}

const server = "https://random-server.com";
const updateUrl = `${server}/update/${process.platform}/${app.getVersion()}`;

autoUpdater.setFeedURL({ url: updateUrl });

if (!isDev) {
  setTimeout(() => {
    autoUpdater.checkForUpdates();
  }, 60000);
}

function createWindow() {
  const win = new BrowserWindow({
    width: 800,
    height: 600,
    icon: "desktop-icons/icon.png",
    webPreferences: {
      preload: path.join(__dirname, "preload.js"),
      nodeIntegration: false,
      contextIsolation: true,
      enableRemoteModule: false,
    },
  });

  win.loadURL(
    isDev
      ? "http://localhost:3001"
      : `file://${path.join(__dirname, "./index.html")}`
  );

}

and hazel server running in vercel fetching my release from github repostitory image is attched .

after 60 seconds i am facing an error image is attached i am usinf electron forge with gihub publish package to publish my release

module.exports = {
  packagerConfig: {
    icon: "desktop-icons/icon",
    name: "chikupos",
    appBundleId: "billing.chikupos.com",
    asar: true,
    hardenedRuntime: true,
  },
  makers: [
    {
      name: "@electron-forge/maker-squirrel",
      config: {
        iconUrl: "https://billing.chikupos.com/desktop-icons/icon.png",
        setupIcon: "desktop-icons/icon.ico",
      },
    },
    {
      name: "@electron-forge/maker-zip",
    },
  ],
  publishers: [
    {
      name: "@electron-forge/publisher-github",
      config: {
        repository: {
          owner: "myusernam",
          name: "my-repository",
        },
        authToken: "my token",
      },
    },
  ],
  buildIdentifier: "billing.chikupos.com",
};

Screenshot 2022-10-19 135834 image

rizwan92 commented 1 year ago

my backend hazel server is returning the Release file to update the squirrel application actually, my repository is private so I am using the hazel server as a proxy to server RELEASE files from my private repository to electron app

directCache [ 'exe', 'dmg', 'rpm', 'deb', 'AppImage' ]
directCache [ 'exe', 'dmg', 'rpm', 'deb', 'AppImage' ]
Finished caching version 1.0.0
releases {
  version: '1.0.0',
  notes: null,
  pub_date: '2022-10-21T13:06:27Z',
  platforms: {
    exe: {
      name: 'chikupos-Setup-1.0.0.exe',
      api_url: 'https://api.github.com/repos/rizwan92/chikupos-software-update/releases/assets/81806373',
      url: 'https://github.com/rizwan92/chikupos-software-update/releases/download/1.0.0/chikupos-Setup-1.0.0.exe',
      content_type: 'application/octet-stream',
      size: 103
    }
  },
  files: {
    RELEASES: 'F2CCE1CA5E1E6060FBC2312E9A33DDC3598C034B https://api.github.com/repos/rizwan92/chikupos-software-update/releases/assets/81806374 101743115'
  }
}
anaisbetts commented 1 year ago

Your releases file is invalid - the 2nd item needs to be a filename, not an arbitrary URL. I would recommend simply uploading your files to a static file host (you can actually even use Vercel itself, which is great because you get HTTPS for free and a CDN) and not try to write your own RELEASES file