this is very small app by which i am trying to download files from s3 bucket, running this behind corporate proxy config. I am using 'https-proxy-agent' to setup proxy in the api call but app is giving error when i am trying to start node app. I tried some other ways to use proxyagent but no luck.
getting the error below.
agent: new ProxyAgent(proxyUrl).
^
TypeError: ProxyAgent is not a constructor
below is my code
const AWS = require('aws-sdk');
const fs = require('fs');
const path = require('path');
const ProxyAgent = require('https-proxy-agent')
const app = express();
const port = 3003;
const proxyUrl = 'http://pac.prod.proxy.cargill.com:4200/proxy.pac'
// Set your AWS credentials and region
AWS.config.update({
secretAccessKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
accessKeyId: 'xxxxxxxxxxxxxxxxxxxx',
region: 'us-east-1',
httpOptions:{
agent: new ProxyAgent(proxyUrl)
}
});
// Initialize S3
const s3 = new AWS.S3();```
The docs for the module say to import it as
, that is, it's not the default export.
That would translate to