From 9e04361e6a12c8825eddd7c420c08321e980c678 Mon Sep 17 00:00:00 2001 From: Tobias Bocanegra Date: Tue, 24 Sep 2024 16:27:00 +0200 Subject: [PATCH] fix: hardcode s3 region (#1000) --- packages/helix-shared-storage/src/storage.js | 3 ++- packages/helix-shared-tokencache/src/S3CacheManager.js | 4 +++- packages/helix-shared-tokencache/src/S3CachePlugin.js | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/helix-shared-storage/src/storage.js b/packages/helix-shared-storage/src/storage.js index d6a9f87c..8ccb06e6 100644 --- a/packages/helix-shared-storage/src/storage.js +++ b/packages/helix-shared-storage/src/storage.js @@ -636,7 +636,7 @@ export class HelixStorage { */ constructor(opts = {}) { const { - region, accessKeyId, secretAccessKey, + region = 'us-east-1', accessKeyId, secretAccessKey, connectionTimeout, socketTimeout, r2AccountId, r2AccessKeyId, r2SecretAccessKey, log = console, @@ -662,6 +662,7 @@ export class HelixStorage { } else { log.debug('Creating S3Client without credentials'); this._s3 = new S3Client({ + region, requestHandler: new NodeHttpHandler({ httpsAgent: new Agent({ keepAlive, diff --git a/packages/helix-shared-tokencache/src/S3CacheManager.js b/packages/helix-shared-tokencache/src/S3CacheManager.js index ea45c4c6..62f90400 100644 --- a/packages/helix-shared-tokencache/src/S3CacheManager.js +++ b/packages/helix-shared-tokencache/src/S3CacheManager.js @@ -49,7 +49,9 @@ export class S3CacheManager { this.secret = opts.secret; this.readOnly = opts.readOnly; this.type = opts.type; - this.s3 = new S3Client(); + this.s3 = new S3Client({ + region: 'us-east-1', + }); } getAuthObjectKey(key) { diff --git a/packages/helix-shared-tokencache/src/S3CachePlugin.js b/packages/helix-shared-tokencache/src/S3CachePlugin.js index 998135db..17ca5a86 100644 --- a/packages/helix-shared-tokencache/src/S3CachePlugin.js +++ b/packages/helix-shared-tokencache/src/S3CachePlugin.js @@ -41,7 +41,9 @@ export class S3CachePlugin { this.secret = opts.secret; this.readOnly = opts.readOnly || false; this.type = opts.type; - this.s3 = new S3Client(); + this.s3 = new S3Client({ + region: 'us-east-1', + }); this.meta = null; this.data = null; }