自动更新程序不适用于 Amazon S3 私有存储桶

问题描述

  • 版本: 22.9.1
  • 电子版
  • 电子类型(当前、测试版、夜间): 11.1.0(稳定)
  • 目标: mac 操作系统 11.1

  • 电子更新程序版本: 4.3.5

我将 S3 设置为私有 (

see screen

),然后将以下内容放入我的更新脚本中:

.......
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;
        });
........

不幸的是,我收到以下错误

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

.....

有人为我提供解决方案吗?

解决方法

我的解决方案:

我为 autoUpdater autoUpdater.setFeedURL('https://[BUCKET].s3.[REGION].amazonaws.com');

设置了 FeedUrl