Electron-builder: Blockmap Comparision Fails for AWS S3

Created on 9 Jul 2018  路  8Comments  路  Source: electron-userland/electron-builder


  • Version: 20.19.2

  • Target: Windows


I found that when we use S3 as a provider then it fails to compare and check blockmap files at this place. This is the log of fileInfo, newBlockMapUrl and oldBlockMapUrl Object.

Fileinfo :-

{
  url: URL{
    href: 'https://AWS_S3_HOST//bucket-yashraj/electron%20Setup%2011.0.3.exe',
    origin: 'https://AWS_S3_HOST',
    protocol: 'https:',
    username: '',
    password: '',
    host: 'AWS_S3_HOST',
    hostname: 'AWS_S3_HOST',
    port: '',
    pathname: '//bucket-yashraj/electron%20Setup%2011.0.3.exe',
    search: '',
    searchParams: URLSearchParams{

    },
    hash: ''
  },
  info: {
    url: 'electron Setup 11.0.3.exe',
    sha512: 'k3seJ1BoSsaxAxODNJqhf7xUh6vfQUflvU+qu0mXXiuBFb8gpvt0oDS2rJm6gP+4lEilw6Gt8bt7BbimXftVNQ==',
    size: 52021199
  }
}

newBlockMapUrl :-

{
  url: URL{
    href: 'https://bucket-yashraj/electron%20Setup%2011.0.3.exe',
    origin: 'https://bucket-yashraj',
    protocol: 'https:',
    username: '',
    password: '',
    host: 'bucket-yashraj',
    hostname: 'bucket-yashraj',
    port: '',
    pathname: '/electron%20Setup%2011.0.3.exe',
    search: '',
    searchParams: URLSearchParams{

    },
    hash: ''
  }
}

oldBlockMapUrl :-

{
  url: URL{
    href: 'https://bucket-yashraj/electron%20Setup%2011.0.3.exe',
    origin: 'https://bucket-yashraj',
    protocol: 'https:',
    username: '',
    password: '',
    host: 'bucket-yashraj',
    hostname: 'bucket-yashraj',
    port: '',
    pathname: '/electron%20Setup%2011.0.3.exe',
    search: '',
    searchParams: URLSearchParams{

    },
    hash: ''
  }
}

You can see that AWS_S3_HOST is removed from newBlockMapUrl and oldBlockMapUrl objects. So it will never get blockmap files!!.

I have checked with replacing ${fileInfo.url.pathname} with ${fileInfo.url.href} and have checked for both provider s3 and general and it is working fine.

@develar I am also creating PR to get reviewed by you if it is proper solution and to make electron better!! :slightly_smiling_face:

bug

Most helpful comment

Let me keep it open since it is electron-builder failure to not strip trailing slash. Humans have a right to make mistakes.

All 8 comments

@develar Line with electron-publisher-s3 information can be removed now from https://www.electron.build/configuration/publish under S3Options as it has already been improved in release 20.19.0

Or can be updated with something like

To use Amazon S3 please add electron-publisher-s3 dependency to devDependencies (yarn add electron-publisher-s3 --dev). It is not required if you are using electron-builder version 20.19.0 or above.

@develar can you guide me on this issue to solve it? or the PR #3092 will work ok for a while until you give a new release with the proper solution.!

@developeryashraj I think issue is that your file url contains double slash after host name. It should be fixed now.

@develar I have tested it with the latest release v20.22.0 and it still fails at the blockmap comparision. I am attaching logs below:

Below are my S3 configuration in package.json

"publish": [
  {
    "provider": "s3",
    "bucket": "bucket-yashraj",
    "endpoint": "https://AWS_S3_HOST/"
  }
]

Still AWS_S3_HOST is missing in blockmap URLs. Here is the complete log (it includes my custom logs as well)

Checking for update
Found version 12.0.3 (url: electron Setup 12.0.3.exe)
update-available
Downloading update from electron Setup 12.0.3.exe
No cached update info available
{
  url: URL{
    href: 'https://AWS_S3_HOST//bucket-yashraj/electron%20Setup%2012.0.3.exe',
    origin: 'https://AWS_S3_HOST',
    protocol: 'https:',
    username: '',
    password: '',
    host: 'AWS_S3_HOST',
    hostname: 'AWS_S3_HOST',
    port: '',
    pathname: '//bucket-yashraj/electron%20Setup%2012.0.3.exe',
    search: '',
    searchParams: URLSearchParams{

    },
    hash: ''
  },
  info: {
    url: 'electron Setup 12.0.3.exe',
    sha512: 'DlUWTATEEhCTXp/YFZaK1cX/OGe0ZlnFRQEPRWOUD/FkatJkRAadpoW0s06NsbSobXLppHEF5SGaF+xRZTQcHg==',
    size: 52018840
  }
} 'fileInfo'
URL {
  href: 'https://bucket-yashraj/electron%20Setup%2012.0.1.exe.blockmap',
  origin: 'https://bucket-yashraj',
  protocol: 'https:',
  username: '',
  password: '',
  host: 'bucket-yashraj',
  hostname: 'bucket-yashraj',
  port: '',
  pathname: '/electron%20Setup%2012.0.1.exe.blockmap',
  search: '',
  searchParams: URLSearchParams{

  },
  hash: ''
} 'oldBlockMapUrl'
URL {
  href: 'https://bucket-yashraj/electron%20Setup%2012.0.3.exe.blockmap',
  origin: 'https://bucket-yashraj',
  protocol: 'https:',
  username: '',
  password: '',
  host: 'bucket-yashraj',
  hostname: 'bucket-yashraj',
  port: '',
  pathname: '/electron%20Setup%2012.0.3.exe.blockmap',
  search: '',
  searchParams: URLSearchParams {},
  hash: '' } 'newBlockMapUrl'
Download block maps (old: "https://bucket-yashraj/electron%20Setup%2012.0.1.exe.blockmap", new: https://bucket-yashraj/electron%20Setup%2012.0.3.exe.blockmap)
Cannot download differentially, fallback to full download: Error: net::ERR_NAME_NOT_RESOLVED
    at CancellationToken.createPromise (C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\node_modules\builder-util-runtime\src\CancellationToken.ts:51:12)
    at ElectronHttpExecutor.doApiRequest (C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\node_modules\builder-util-runtime\src\httpExecutor.ts:84:30)
    at ElectronHttpExecutor.request (C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\node_modules\builder-util-runtime\src\httpExecutor.ts:74:17)
    at C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\NsisUpdater.ts:160:10
    at Generator.next (<anonymous>)
From previous event:
    at downloadBlockMap (C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\NsisUpdater.ts:170:13)
    at C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\NsisUpdater.ts:174:28
    at Generator.next (<anonymous>)
From previous event:
    at NsisUpdater.differentialDownloadInstaller (C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\NsisUpdater.ts:190:122)
    at Object.<anonymous> (C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\NsisUpdater.ts:40:42)
    at Generator.next (<anonymous>)
From previous event:
    at Object.task (C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\NsisUpdater.ts:37:7)
    at C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\BaseUpdater.ts:104:25
    at Generator.throw (<anonymous>)
From previous event:
    at NsisUpdater.executeDownload (C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\BaseUpdater.ts:29:68)
    at C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\NsisUpdater.ts:32:23
From previous event:
    at NsisUpdater.doDownloadUpdate (C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\NsisUpdater.ts:22:80)
    at C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\AppUpdater.ts:365:25
From previous event:
    at NsisUpdater.downloadUpdate (C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\AppUpdater.ts:354:86)
    at C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\AppUpdater.ts:341:49
From previous event:
    at NsisUpdater.doCheckForUpdates (C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\AppUpdater.ts:311:34)
    at C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\AppUpdater.ts:283:25
    at Generator.next (<anonymous>)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
    at NsisUpdater._checkForUpdates (C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\AppUpdater.ts:278:33)
    at NsisUpdater.checkForUpdates (C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\node_modules\electron-updater\src\AppUpdater.ts:217:35)
    at EventEmitter.ipcMain.on (C:\Users\yashraj\AppData\Local\Programs\electron\resources\app.asar\main.js:621:19)
    at emitOne (events.js:116:13)
    at EventEmitter.emit (events.js:211:7)
    at WebContents.<anonymous> (C:\Users\yashraj\AppData\Local\Programs\electron\resources\electron.asar\browser\api\web-contents.js:286:13)
    at emitTwo (events.js:126:13)
    at WebContents.emit (events.js:214:7)

Hope this helps to trace the issue!

"publish": [
  {
    "provider": "s3",
    "bucket": "bucket-yashraj",
    "endpoint": "https://AWS_S3_HOST/"
  }
]

Do not use endpoint. Or remove trailing slash.

@develar Thanks for the reply. Let me give it a try and come back here with the updates.

@develar It was my bad. It's just that trailing slash "/" in the endpoint :unamused: Thanks for the help. :+1: It's working !!

Let me keep it open since it is electron-builder failure to not strip trailing slash. Humans have a right to make mistakes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NPellet picture NPellet  路  3Comments

omarkilani picture omarkilani  路  3Comments

leo picture leo  路  3Comments

jhg picture jhg  路  3Comments

JohnWeisz picture JohnWeisz  路  3Comments