question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

blockmap Forbidden - autoUpdater - private S3 bucket

See original GitHub issue
  • Version: 20.44.4
  • Target: Windows

I am getting this error after removing public access from my S3 bucket through the AWS console. It also happens when I grant full public access to the bucket and use ‘acl’: ‘private’ in my publish config.

cannot download differentially, fallback to full download: 
Error: Cannot download "https://mybucket.s3.amazonaws.com/releases/electron/win/MyApp%20Setup%200.0.6.exe.blockmap", status 403: Forbidden

The actual Setup file seems to download fine.

It is a private repository but I have given my AWS user FullS3Access and it still doesn’t work.

Is this the problem?: It can see that the aws region is missing from my autoUpdater blockmap requests:

Download block maps (old: "https://mybucket.s3.amazonaws.com/releases/electron/win/MyApp%20Setup%200.0.6.exe.blockmap", new: https://mybucket.s3.amazonaws.com/releases/electron/win/MyApp%20Setup%200.0.7.exe.blockmap)

The files are actually located at: https://mybucket.s3-eu-west-1.amazonaws.com/releases/electron/win/MyApp+Setup+0.0.6.exe.blockmap

So the region is being added correctly to my autoUpdater.requestHeaders but I have no control over the blockmap request urls.

I am using aws4 to sign my request headers.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:28 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
linchen1010commented, Apr 14, 2022

I also had this issue during developing. It’s not a solution but I end up using aws-sdk to download my file if electron-updater found any updated version in my private S3. Note: This will not utilize the blockmap to download the updated app, so it might take a few more seconds to download your app. You will also need to run the installer manually to trigger that update, I did it with child_process.spawn.

First, disable autoDownload:

autoUpdater.autoDownload = false;
import * as AWS from 'aws-sdk';
import fs from 'fs';
import aws4 from 'aws4'

autoUpdater.on('checking-for-update', () => {
    let opts = {
        service: 's3',
        region: s3_region,
        host: s3_host,
        path: latest_yml_path
    };
  
    aws4.sign(opts, {
        accessKeyId,
        secretAccessKey,
        sessionToken
    });
    autoUpdater.requestHeaders = opts.headers
})

autoUpdater.on('update-available', (updateInfo) => {
    AWS.config.update({
        accessKeyId,
        secretAccessKey,
        sessionToken
    });
    const s3 = new AWS.S3();
    const version = this.getVersion(updateInfo.path);
    const params = {
        Bucket: `${your_s3_bucket}`,
        Key: `${path_to_your_file)`
    }
   download(s3, params);
})

and the download looks something like this:

const download = (s3, params) => {
  s3.getObject(params, async (err, data) => {
      if (err) {
          throw new Error(err)
      }
      await fs.promises.writeFile(filePath, data.Body);
      console.info(`${filePath} has been downloaded!`);
      autoUpdater.emit('update-downloaded', filePath);
  });
}
1reaction
rohanrk-triconcommented, Sep 26, 2022

Were you able to find out how to achieve it for a private s3 bucket? It’s still not working for me. @stuartcusackie @develar @mayankvadia @justinwaite ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Auto Updater does not work for Amazon S3 private Bucket
My solution: I set the FeedUrl for autoUpdater autoUpdater.setFeedURL('https://[BUCKET].s3.[REGION].amazonaws.com');.
Read more >
electron auto updater without code signing - You.com | The AI ...
Is it possible to auto-update Electron apps without a certificate? ... The issue I came across is with using non-public AWS S3 bucket...
Read more >
Auto Update - electron-builder
Private GitHub Update Repo¶. You can use a private repository for updates with electron-updater by setting the GH_TOKEN environment variable (on user machine) ......
Read more >
electron auto update s3的推薦與評價, 網紅們這樣 ... - 最新趨勢觀測站
I am new to electron, i need to add this functionality of autoUpdate but with private s3 bucket as i have a private...
Read more >
electron-builder | Yarn - Package Manager
... Electron app for MacOS, Windows and Linux with “auto update” support out of the box ... Add the accelerate option for s3...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found