electron-builderelectron-updater

Electron application fails to update all of a sudden


My electron application was working just fine and all of a sudden new updates fail to download with the following error

Checking for update
[2023-01-13 16:42:04.897] [error] Error: Error: Cannot parse update info from latest.yml in the latest release artifacts (https://net2qa.netapp.com/client/win/latest.yml?noCache=1gmld8n1b): YAMLException: end of the stream or a document separator is expected (2:11)

 1 | <!DOCTYPE html>
 2 | <!-- Build: 1.0.2817.0 -->
---------------^
 3 | <!-- StateVersion: 2.1.1 -->
 4 | <!-- DeploymentMode: Development -->
    at generateError (C:\Users\test\AppData\Local\Programs\net2offlineclient-qa\resources\app\node_modules\js-yaml\lib\loader.js:183:10)
    at throwError (C:\Users\test\AppData\Local\Programs\net2offlineclient-qa\resources\app\node_modules\js-yaml\lib\loader.js:187:9)
    at readDocument (C:\Users\test\AppData\Local\Programs\net2offlineclient-qa\resources\app\node_modules\js-yaml\lib\loader.js:1645:5)
    at loadDocuments (C:\Users\test\AppData\Local\Programs\net2offlineclient-qa\resources\app\node_modules\js-yaml\lib\loader.js:1688:5)
    at Object.load (C:\Users\test\AppData\Local\Programs\net2offlineclient-qa\resources\app\node_modules\js-yaml\lib\loader.js:1714:19)
    at Object.parseUpdateInfo (C:\Users\test\AppData\Local\Programs\net2offlineclient-qa\resources\app\node_modules\electron-updater\out\providers\Provider.js:82:28)
    at GenericProvider.getLatestVersion (C:\Users\test\AppData\Local\Programs\net2offlineclient-qa\resources\app\node_modules\electron-updater\out\providers\GenericProvider.js:23:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async NsisUpdater.getUpdateInfoAndProvider (C:\Users\test\AppData\Local\Programs\net2offlineclient-qa\resources\app\node_modules\electron-updater\out\AppUpdater.js:319:19)
    at async NsisUpdater.doCheckForUpdates (C:\Users\test\AppData\Local\Programs\net2offlineclient-qa\resources\app\node_modules\electron-updater\out\AppUpdater.js:333:24), rawData: <!DOCTYPE html>
<!-- Build: 1.0.2817.0 -->
<!-- StateVersion: 2.1.1 -->
<!-- DeploymentMode: Development -->
<!-- CorrelationId: a3e10eac-45cb-4dc2-ac07-0d80c9e5ba8d -->
<!-- DataCenter: PNQ -->
<!-- Slice: 001-000 -->
<html lang="en"><head><link rel="icon" href="data:;base64,iVBORw0KGgo="><script data-container="true" nonce="91dduewxjK+C2hhaclwx1w==">var CP = {
  "list": []
};
var SA_FIELDS = {
  "AttributeFields": [
    {
      "UX_INPUT_TYPE": "TextBox",
      "USER_INPUT_TYPE": "TextBox",
      "IS_TEXT": true,
      "IS_EMAIL": false,
      "IS_PASSWORD": false,
      "IS_DATE": false,
      "IS_RADIO": false,
      "IS_DROP": false,
      "IS_TEXT_IN_PARAGRAPH": false,
      "IS_CHECK_MULTI": false,
      "IS_LINK": false,
      "VERIFY": false,
      "DN": "Email Address",
      "ID": "signInName",
      "U_HELP": "",
      "DAY_PRE": "0",
      "MONTH_PRE": "0",
      "YEAR_PRE": "0",
      "IS_REQ": true,
      "IS_RDO": false,
      "OPTIONS": []
    }
  ]
};

I've deleted my node_modules folder and also updated NodeJS, electronJS, Electron Builder and also Updated Electron updater.

There hasn't been any changes in the application from the previous version to the new one in terms of adding new lib or or any major file changes, just some JavaScript fixes.

Any help here or pointing me in the right direction will be much appreciated!

Electron-Builder Version: 23.3.3 Electron-Updater Version: 5.2.1 Node Version: 18.9.0 Electron Version: 20.1.4


Solution

  • Okay, I was able to figure it out but the error message being shown is very misleading. So the issue was when the updater tried to download the file from the provided URL, it was being redirected to the login page (even though it had a bearer token) and it was failing because it was expecting a file to download but got a HTML page as the data.