0

I am implementing auto update feature for my Electron app. I am encountering an error:

[Error: Update check failed. The server sent an invalid response. Try again later.] {
  code: 6,
  domain: 'SQRLUpdaterErrorDomain'
}

This error is thrown from inside Electron node module, specifically from Squirrel.framework:

Binary file ./dist/Electron.app/Contents/Frameworks/Squirrel.framework/Versions/A/Squirrel

Part of my electron main.js code:

    const { app, autoUpdater } = require('electron');

    let version  = app.getVersion();
    let server   = 'https://colube-deploy-pnjad1iun-wenwu.vercel.app';
    //let url    = `${server}/update/${process.platform}/${app.getVersion()}`;
    let platform = process.platform + '_arm64';
    let url      = `${server}/update/${platform}/${version}`;

    autoUpdater.setFeedURL({ url });

    setInterval(() => {
        autoUpdater.checkForUpdates();
    }, 15 * 60 * 1000);

    setTimeout(() => {
        autoUpdater.checkForUpdates();
    }, 3000);

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

releaseName, releaseNotes);

        const dialogOpts = {
            type    : 'info',
            buttons : ['Restart', 'Later'],
            title   : 'Application Update',
            message : process.platform === 'win32' ? releaseNotes : releaseName,
            detail  : 'A new version has been downloaded. Restart the application to apply the updates.',
        }

        dialog.showMessageBox(dialogOpts).then((returnValue) => {
            if (returnValue.response === 0) autoUpdater.quitAndInstall();
        })
    });

    autoUpdater.on('before-quit-for-update', () => {
    });

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

Some background information:

  • I am testing on M2-chip MacOS Monterey 12.4. Electron version is ^19.0.8
  • I am using autoUpdater from electron module
  • I am using Hazel which is recommended in Electron official document.
  • Hazel is deployed to Vercel.
  • App releases are behind a private github repo.
  • App releases are notarized by Apple successfully.
  • Hazel server is configured with environment variable TOKEN (my github personal token).
  • The url argument passed to setFeedURL() is https://colube-deploy-pnjad1iun-wenwu.vercel.app/update/darwin_arm64/0.9.13
  • Vercel server response to request autoUpdater.checkForUpdates() is status code 200 with object like:
{
    name: 'v0.9.17',
    notes: '',
    pub_date: '2022-07-31T13:47:34Z',
    url: 'colube-deploy-pnjad1iun-wenwu.vercel.app/download/darwin_arm64?update=true'
}
  • Paste above response url colube-deploy-pnjad1iun-wenwu.vercel.app/download/darwin_arm64?update=true to browser can successfully download the app.
Wenwu
  • 45
  • 6
  • Any update on this? I am struggling with the same issue – Peter Maher Aug 17 '22 at 10:34
  • @PeterMaher I changed my private app release repository to public, now I use Electron's officially recommended auto-update service "update.electronjs.org", auto-update works fine now. – Wenwu Aug 19 '22 at 02:23
  • @PeterMaher did you find a way to overcome this issue without changing your repo to public like suggested above? – silveur Mar 09 '23 at 17:35

0 Answers0