From 1e25dfa826df6be5f31e099b2ab85d2378b10fe9 Mon Sep 17 00:00:00 2001 From: Patrique Legault Date: Wed, 27 Aug 2025 16:59:13 -0400 Subject: [PATCH] Update remote-storage.js --- lib/remote-storage.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/remote-storage.js b/lib/remote-storage.js index 0481539..ef31545 100644 --- a/lib/remote-storage.js +++ b/lib/remote-storage.js @@ -17,6 +17,9 @@ const fs = require('fs-extra') const joi = require('joi') const klaw = require('klaw') const http = require('http') +import { NodeHttpHandler } from "@smithy/node-http-handler" +import { ProxyAgent } from "proxy-agent" +import dotenv from 'dotenv' const { codes, logAndThrow } = require('./StorageError') const fileExtensionPattern = /\*\.[0-9a-zA-Z]+$/ @@ -71,8 +74,16 @@ module.exports = class RemoteStorage { } this.bucket = creds.params.Bucket + dotenv.config(); + const proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY; // this means HTTPS proxy takes precedence + const agent = proxyUrl ? new ProxyAgent(proxyUrl) : undefined; + // https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/classes/s3.html#constructor - this.s3 = new S3({ credentials, region }) + this.s3 = new S3({requestHandler: new NodeHttpHandler({ + httpAgent: agent, + httpsAgent: agent + }), + credentials, region }) } /**