electron-builder: Error: Unable to find latest version on GitHub

  • Electron-Builder Version: 23.0.3
  • Electron-Updater Version: 5.0.1
  • Node Version: 17.9.0
  • Electron Version: 18.0.3
  • Electron Type (current, beta, nightly): Current
  • Target: nsis

electron-updater 5.0.1 fails to auto update from private Github repo. If I build my app using v5.0.1 and a newer release is available on the private repo, I now get an error after autoUpdater.checkForUpdatesAndNotify()

autoUpdater.on('error', (error) => {
  console.error(error)
})

logs:

Error: Unable to find latest version on GitHub (https://api.github.com/api/v3/repos/<private-repo>), please ensure a production release exists: HttpError: 404 “method: GET url: https://api.github.com/api/v3/repos/<private-repo>/releases\n\nPlease double check that your authentication token is correct. Due to security reasons, actual status maybe not reported, but 404.\n” Headers: { “server”: “GitHub.com”, “date”: “Mon, 11 Apr 2022 16:02:57 GMT”, “content-type”: “application/json; charset=utf-8”, “x-oauth-scopes”: “repo, workflow, write:packages”, “x-accepted-oauth-scopes”: “repo”, “x-github-media-type”: “github.v3; format=json”, “x-ratelimit-limit”: “5000”, “x-ratelimit-remaining”: “4983”, “x-ratelimit-reset”: “1649694314”, “x-ratelimit-used”: “17”, “x-ratelimit-resource”: “core”, “access-control-expose-headers”: “ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset”, “access-control-allow-origin”: “*”, “strict-transport-security”: “max-age=31536000; includeSubdomains; preload”, “x-frame-options”: “deny”, “x-content-type-options”: “nosniff”, “x-xss-protection”: “0”, “referrer-policy”: “origin-when-cross-origin, strict-origin-when-cross-origin”, “content-security-policy”: “default-src ‘none’”, “vary”: “Accept-Encoding, Accept, X-Requested-With”, “content-encoding”: “gzip”, “x-github-request-id”: “E97B:0C3D:222588:2C9CBB:62545131” } at createHttpError (<local-install-path>\resources\app.asar\node_modules\builder-util-runtime\out\httpExecutor.js:14:12) at ElectronHttpExecutor.handleResponse (<local-install-path>\resources\app.asar\node_modules\builder-util-runtime\out\httpExecutor.js:116:20) at ClientRequest. (<local-install-path>\resources\app.asar\node_modules\builder-util-runtime\out\httpExecutor.js:82:26) at ClientRequest.emit (node:events:390:28) at SimpleURLLoaderWrapper. (node:electron/js2c/browser_init:101:6917) at SimpleURLLoaderWrapper.emit (node:events:390:28)

Looks like it may be failing to authenticate with the private token which I include in my package.json. Here is the build part of my package.json:

"build": {
    "publish": [
      {
        "provider": "github",
        "releaseType": "release",
        "private": true,
        "token": "<private-token>"
      }
    ],
    "win": {
      "target": "nsis"
    },
    "nsis": {
      "deleteAppDataOnUninstall": true,
      "oneClick": false
    },
    "directories": {
      "buildResources": "assets"
    }
  }

Reverting back to v4.6.5 of electron-updater fixes the issue.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (2 by maintainers)

Commits related to this issue

Most upvoted comments

+, I downgrade Electron-Updater to version 4.6.5 and it works fine now.

I am still getting this using 5.2.1 - public repo, releases are there.

@v360tech-sadhana can you try electron-builder and electron-updater @next instead of @latest?

I moved back to electron-builder v4.6.1 and it’s working fine. You can give it a try!

@RoikkuTo can you please open a PR for that? I’d also recommend changing it to be clearer and to account for an empty string:

return host && !["github.com", "api.github.com"].includes(host) ? `/api/v3${result}` : result