Skip to content

Commit 989ec35

Browse files
authored
fix: upgrade proxy-agent to ^6.3.0 to remove vm2 deps (#13012)
* ci: upgrade proxy-agent to ^6.3.0 to remove vm2 deps * ci: unset IS_AMPLIFY_CI for verify api extract step, yarn lock update * chore: comment
1 parent 07af8e2 commit 989ec35

File tree

11 files changed

+147
-152
lines changed

11 files changed

+147
-152
lines changed

packages/amplify-category-notifications/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"lodash": "^4.17.21",
3737
"ora": "^4.0.3",
3838
"promise-sequential": "^1.1.1",
39-
"proxy-agent": "^5.0.0"
39+
"proxy-agent": "^6.3.0"
4040
},
4141
"jest": {
4242
"testEnvironmentOptions": {

packages/amplify-category-notifications/src/pinpoint-helper.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
resolveRegion,
3434
loadConfigurationForEnv,
3535
} from '@aws-amplify/amplify-provider-awscloudformation';
36-
import proxyAgent from 'proxy-agent';
36+
import { ProxyAgent } from 'proxy-agent';
3737
const spinner = ora('');
3838
const defaultPinpointRegion = 'us-east-1';
3939

@@ -544,10 +544,11 @@ export const getPinpointClient = async (
544544
customUserAgent: formUserAgentParam(context, userAgentAction),
545545
};
546546

547+
// HTTP_PROXY & HTTPS_PROXY env vars are read automatically by ProxyAgent, but we check to see if they are set before using the proxy
547548
if (httpProxy) {
548549
aws.config.update({
549550
httpOptions: {
550-
agent: proxyAgent(httpProxy),
551+
agent: new ProxyAgent(),
551552
},
552553
});
553554
}

packages/amplify-cli-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"node-fetch": "^2.6.7",
5353
"open": "^8.4.0",
5454
"ora": "^4.0.3",
55-
"proxy-agent": "^5.0.0",
55+
"proxy-agent": "^6.3.0",
5656
"semver": "^7.5.4",
5757
"typescript-json-schema": "~0.52.0",
5858
"which": "^2.0.2",

packages/amplify-cli-core/src/banner-message/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fetch from 'node-fetch';
22
import semver from 'semver';
3-
import ProxyAgent from 'proxy-agent';
3+
import { ProxyAgent } from 'proxy-agent';
44
import { getLogger } from '../logger';
55

66
export type Message = {
@@ -43,7 +43,8 @@ export class BannerMessage {
4343
try {
4444
logger.info(`fetch banner messages from ${url}`);
4545
const proxy = process.env.HTTP_PROXY || process.env.HTTPS_PROXY;
46-
const fetchOptions = proxy ? { agent: new ProxyAgent(proxy) } : {};
46+
// HTTP_PROXY & HTTPS_PROXY env vars are read automatically by ProxyAgent, but we check to see if they are set before using the proxy
47+
const fetchOptions = proxy ? { agent: new ProxyAgent() } : {};
4748
const result = await fetch(url, fetchOptions);
4849
const body = await result.json();
4950
if (!semver.satisfies(body.version, MAX_SUPPORTED_MESSAGE_CONFIG_VERSION)) {

packages/amplify-provider-awscloudformation/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"node-fetch": "^2.6.7",
6767
"ora": "^4.0.3",
6868
"promise-sequential": "^1.1.1",
69-
"proxy-agent": "^5.0.0",
69+
"proxy-agent": "^6.3.0",
7070
"rimraf": "^3.0.0",
7171
"xstate": "^4.14.0"
7272
},

packages/amplify-provider-awscloudformation/src/aws-utils/aws-amplify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const aws = require('aws-sdk');
2-
const proxyAgent = require('proxy-agent');
2+
const { ProxyAgent } = require('proxy-agent');
33
const configurationManager = require('../configuration-manager');
44
const { regions: amplifyServiceRegions } = require('../aws-regions');
55

@@ -24,7 +24,7 @@ async function getConfiguredAmplifyClient(context, options = {}) {
2424
if (httpProxy) {
2525
aws.config.update({
2626
httpOptions: {
27-
agent: proxyAgent(httpProxy),
27+
agent: new ProxyAgent(),
2828
},
2929
});
3030
}

packages/amplify-provider-awscloudformation/src/aws-utils/aws.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ try {
2222
aws = require('aws-sdk');
2323
}
2424

25-
const proxyAgent = require('proxy-agent');
25+
const { ProxyAgent } = require('proxy-agent');
2626
const configurationManager = require('../configuration-manager');
2727

2828
aws.configureWithCreds = async (context) => {
@@ -35,7 +35,7 @@ aws.configureWithCreds = async (context) => {
3535
if (httpProxy) {
3636
aws.config.update({
3737
httpOptions: {
38-
agent: proxyAgent(httpProxy),
38+
agent: new ProxyAgent(httpProxy),
3939
},
4040
});
4141
}

packages/amplify-provider-awscloudformation/src/configuration-manager.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import chalk from 'chalk';
1313
import { prompt } from 'inquirer';
1414
import _ from 'lodash';
1515
import path from 'path';
16-
import proxyAgent from 'proxy-agent';
16+
import { ProxyAgent } from 'proxy-agent';
1717
import { STS } from 'aws-sdk';
1818
import awsRegions from './aws-regions';
1919
import constants from './constants';
@@ -838,10 +838,11 @@ export async function getAwsConfig(context: $TSContext): Promise<AwsSdkConfig> {
838838
}
839839
}
840840

841+
// HTTP_PROXY & HTTPS_PROXY env vars are read automatically by ProxyAgent, but we check to see if they are set before using the proxy
841842
if (httpProxy) {
842843
resultAWSConfigInfo = {
843844
...resultAWSConfigInfo,
844-
httpOptions: { agent: proxyAgent(httpProxy) },
845+
httpOptions: { agent: new ProxyAgent() },
845846
};
846847
}
847848

packages/amplify-provider-awscloudformation/src/system-config-manager.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as fs from 'fs-extra';
55
import * as path from 'path';
66
import * as ini from 'ini';
77
import * as inquirer from 'inquirer';
8-
import proxyAgent from 'proxy-agent';
8+
import { ProxyAgent } from 'proxy-agent';
99
import * as constants from './constants';
1010
import { fileLogger } from './utils/aws-logger';
1111
import { AwsSdkConfig } from './utils/auth-types';
@@ -123,10 +123,11 @@ export const getProfiledAwsConfig = async (
123123
});
124124
}
125125

126+
// HTTP_PROXY & HTTPS_PROXY env vars are read automatically by ProxyAgent, but we check to see if they are set before using the proxy
126127
if (httpProxy) {
127128
awsConfigInfo = {
128129
...awsConfigInfo,
129-
httpOptions: { agent: proxyAgent(httpProxy) },
130+
httpOptions: { agent: new ProxyAgent() },
130131
};
131132
}
132133

packages/amplify-provider-awscloudformation/src/utils/admin-helpers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { stateManager, $TSContext, AmplifyError, AmplifyFault } from '@aws-ampli
22
import aws from 'aws-sdk';
33
import _ from 'lodash';
44
import fetch from 'node-fetch';
5-
import proxyAgent from 'proxy-agent';
5+
import { ProxyAgent } from 'proxy-agent';
66
import { adminLoginFlow } from '../admin-login';
77
import { AdminAuthConfig, AwsSdkConfig, CognitoAccessToken, CognitoIdToken } from './auth-types';
88
import { printer, prompter } from '@aws-amplify/amplify-prompts';
@@ -89,8 +89,9 @@ type AppStateResponse = {
8989
async function getAdminAppState(appId: string, region: string): Promise<AppStateResponse> {
9090
// environment variable AMPLIFY_CLI_APPSTATE_BASE_URL useful for development against beta/gamma appstate endpoints
9191
const appStateBaseUrl = process.env.AMPLIFY_CLI_APPSTATE_BASE_URL ?? adminBackendMap[region].appStateUrl;
92+
// HTTP_PROXY & HTTPS_PROXY env vars are read automatically by ProxyAgent, but we check to see if they are set before using the proxy
9293
const httpProxy = process.env.HTTP_PROXY || process.env.HTTPS_PROXY;
93-
const fetchOptions = httpProxy ? { agent: proxyAgent(httpProxy) } : {};
94+
const fetchOptions = httpProxy ? { agent: new ProxyAgent() } : {};
9495
const res = await fetch(`${appStateBaseUrl}/AppState/?appId=${appId}`, fetchOptions);
9596
if (res.status >= 500) {
9697
throw new AmplifyFault('ServiceCallFault', {

0 commit comments

Comments
 (0)