Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: upgrade proxy-agent to ^6.3.0 to remove vm2 deps #13012

Merged
merged 4 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/amplify-category-notifications/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"lodash": "^4.17.21",
"ora": "^4.0.3",
"promise-sequential": "^1.1.1",
"proxy-agent": "^5.0.0"
"proxy-agent": "^6.3.0"
},
"jest": {
"testEnvironmentOptions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
resolveRegion,
loadConfigurationForEnv,
} from '@aws-amplify/amplify-provider-awscloudformation';
import proxyAgent from 'proxy-agent';
import { ProxyAgent } from 'proxy-agent';
const spinner = ora('');
const defaultPinpointRegion = 'us-east-1';

Expand Down Expand Up @@ -547,7 +547,7 @@ export const getPinpointClient = async (
if (httpProxy) {
aws.config.update({
httpOptions: {
agent: proxyAgent(httpProxy),
agent: new ProxyAgent(),
awsluja marked this conversation as resolved.
Show resolved Hide resolved
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/amplify-cli-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"node-fetch": "^2.6.7",
"open": "^8.4.0",
"ora": "^4.0.3",
"proxy-agent": "^5.0.0",
"proxy-agent": "^6.3.0",
"semver": "^7.5.4",
"typescript-json-schema": "~0.52.0",
"which": "^2.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/amplify-cli-core/src/banner-message/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fetch from 'node-fetch';
import semver from 'semver';
import ProxyAgent from 'proxy-agent';
import { ProxyAgent } from 'proxy-agent';
import { getLogger } from '../logger';

export type Message = {
Expand Down Expand Up @@ -43,7 +43,7 @@ export class BannerMessage {
try {
logger.info(`fetch banner messages from ${url}`);
const proxy = process.env.HTTP_PROXY || process.env.HTTPS_PROXY;
const fetchOptions = proxy ? { agent: new ProxyAgent(proxy) } : {};
const fetchOptions = proxy ? { agent: new ProxyAgent() } : {};
const result = await fetch(url, fetchOptions);
const body = await result.json();
if (!semver.satisfies(body.version, MAX_SUPPORTED_MESSAGE_CONFIG_VERSION)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/amplify-provider-awscloudformation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"node-fetch": "^2.6.7",
"ora": "^4.0.3",
"promise-sequential": "^1.1.1",
"proxy-agent": "^5.0.0",
"proxy-agent": "^6.3.0",
"rimraf": "^3.0.0",
"xstate": "^4.14.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const aws = require('aws-sdk');
const proxyAgent = require('proxy-agent');
const { ProxyAgent } = require('proxy-agent');
const configurationManager = require('../configuration-manager');
const { regions: amplifyServiceRegions } = require('../aws-regions');

Expand All @@ -24,7 +24,7 @@ async function getConfiguredAmplifyClient(context, options = {}) {
if (httpProxy) {
aws.config.update({
httpOptions: {
agent: proxyAgent(httpProxy),
agent: new ProxyAgent(),
},
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ try {
aws = require('aws-sdk');
}

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

aws.configureWithCreds = async (context) => {
Expand All @@ -35,7 +35,7 @@ aws.configureWithCreds = async (context) => {
if (httpProxy) {
aws.config.update({
httpOptions: {
agent: proxyAgent(httpProxy),
agent: new ProxyAgent(httpProxy),
},
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import chalk from 'chalk';
import { prompt } from 'inquirer';
import _ from 'lodash';
import path from 'path';
import proxyAgent from 'proxy-agent';
import { ProxyAgent } from 'proxy-agent';
import { STS } from 'aws-sdk';
import awsRegions from './aws-regions';
import constants from './constants';
Expand Down Expand Up @@ -841,7 +841,7 @@ export async function getAwsConfig(context: $TSContext): Promise<AwsSdkConfig> {
if (httpProxy) {
resultAWSConfigInfo = {
...resultAWSConfigInfo,
httpOptions: { agent: proxyAgent(httpProxy) },
httpOptions: { agent: new ProxyAgent() },
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as fs from 'fs-extra';
import * as path from 'path';
import * as ini from 'ini';
import * as inquirer from 'inquirer';
import proxyAgent from 'proxy-agent';
import { ProxyAgent } from 'proxy-agent';
import * as constants from './constants';
import { fileLogger } from './utils/aws-logger';
import { AwsSdkConfig } from './utils/auth-types';
Expand Down Expand Up @@ -126,7 +126,7 @@ export const getProfiledAwsConfig = async (
if (httpProxy) {
awsConfigInfo = {
...awsConfigInfo,
httpOptions: { agent: proxyAgent(httpProxy) },
httpOptions: { agent: new ProxyAgent() },
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { stateManager, $TSContext, AmplifyError, AmplifyFault } from '@aws-ampli
import aws from 'aws-sdk';
import _ from 'lodash';
import fetch from 'node-fetch';
import proxyAgent from 'proxy-agent';
import { ProxyAgent } from 'proxy-agent';
import { adminLoginFlow } from '../admin-login';
import { AdminAuthConfig, AwsSdkConfig, CognitoAccessToken, CognitoIdToken } from './auth-types';
import { printer, prompter } from '@aws-amplify/amplify-prompts';
Expand Down Expand Up @@ -90,7 +90,7 @@ async function getAdminAppState(appId: string, region: string): Promise<AppState
// environment variable AMPLIFY_CLI_APPSTATE_BASE_URL useful for development against beta/gamma appstate endpoints
const appStateBaseUrl = process.env.AMPLIFY_CLI_APPSTATE_BASE_URL ?? adminBackendMap[region].appStateUrl;
const httpProxy = process.env.HTTP_PROXY || process.env.HTTPS_PROXY;
const fetchOptions = httpProxy ? { agent: proxyAgent(httpProxy) } : {};
const fetchOptions = httpProxy ? { agent: new ProxyAgent() } : {};
const res = await fetch(`${appStateBaseUrl}/AppState/?appId=${appId}`, fetchOptions);
if (res.status >= 500) {
throw new AmplifyFault('ServiceCallFault', {
Expand Down
Loading