Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

electron - Auto Updater does not work for Amazon S3 private Bucket

  • Version: 22.9.1
  • Electron Version:
  • Electron Type (current, beta, nightly): 11.1.0 (stable)
  • Target: mac OS 11.1

  • Electron Updater Version: 4.3.5

I set my S3 to private (see screen) and then put the following in my update script:

.......
autoUpdater.on('checking-for-update', () => {
            if (w !== undefined) {
                w.get('settings').content().send('check-for-updates-begin');
            }

            let opts = {
                service: 's3',
                region: 'eu-central-1',
                host: s3_bucket + '.s3.eu-central-1.amazonaws.com',
                path: '/latest-mac.yml' // For example....
            };
            aws4.sign(opts, {
                accessKeyId: "XXXXX",
                secretAccessKey: "XXXXXXXX"
            });

            autoUpdater.requestHeaders = opts.headers;
        });
........

Unfortunately, I then get the following error:

Error: HttpError: 403 Forbidden
"<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>

.....

Someone a solution for me?

question from:https://stackoverflow.com/questions/65914263/auto-updater-does-not-work-for-amazon-s3-private-bucket

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

My solution:

I set the FeedUrl for autoUpdater autoUpdater.setFeedURL('https://[BUCKET].s3.[REGION].amazonaws.com');


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...