Skip to content
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

Error: Update check failed. The server sent an invalid JSON response #150

Open
wenwuwu opened this issue Aug 1, 2022 · 2 comments
Open

Comments

@wenwuwu
Copy link

wenwuwu commented Aug 1, 2022

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.
@petem24
Copy link

petem24 commented Aug 17, 2022

Having the exact same issue here

@petem24
Copy link

petem24 commented Aug 17, 2022

#131 - This issue fixed it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants