electron-builder: Autoupdater problem on mac if space in the name

  • Version: 12.0.3
  • Target: Mac

I have my app packaged correctly and uploaded to an S3 bucket (something which I previously did with the Windows version), but the autoupdater doesn’t work on mac (it works fine on Windows though).

When running my app from the terminal so I can see the logging I see this:

App is ready
Checking for update
Found version 1.0.91 (url: https://s3-eu-west-1.amazonaws.com/*****/releases/MyApp-1.0.91-mac.zip)
Downloading update from https://s3-eu-west-1.amazonaws.com/*****/releases/MyApp-1.0.91-mac.zip
{ Error: Update check failed. The server sent an invalid JSON response. Try again later.
  preventDefault: [Function: preventDefault],
  sender:
   AutoUpdater {
     _events: { error: [Function], 'update-downloaded': [Function] },
     _eventsCount: 2 } }
Error: Error: Update check failed. The server sent an invalid JSON response. Try again later.

latest-mac.json contains

{
  "version": "1.0.91",
  "url": "https://s3-eu-west-1.amazonaws.com/*****/releases/MyApp-1.0.91-mac.zip"
}

What could be the problem?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Bingo!

Sometimes it helps to walk away from the computer in order to find it. My Product Name has spaces in it, therefore the generated JSON file also has spaces in the URL. I manually edited the JSON file on S3 and replaced the spaces with %20 and it works!

The yml file for my windows updates also contains the spaces in the file name, but it seems that isn’t a problem as I guess you build the URL yourself from the filename.

So I guess it would be a good idea to URLEncode the filename that is put in latest-mac.json before upload.

That was a productive day …

Looks like it should be const {autoUpdater} = require('electron-updater') or const autoUpdater = require('electron-updater').autoUpdater based on the wiki.