Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
77a1e9e
refactor: start provider-cloudformation
Jul 11, 2025
aca2d07
refactor: category storage
Jul 14, 2025
28e12ba
chore: returning aws-sdk for now
Jul 15, 2025
6bb961e
fix: yarn lock
Jul 15, 2025
4b26596
fix: some adjustments
Jul 16, 2025
53cb005
fix: fixed some tests
Jul 16, 2025
ba3238d
refactor: most of provider-awscloudformation
Jul 17, 2025
d2a8a87
fix: import lex
Jul 17, 2025
ef3fe96
refactor: last set of non-test files
Jul 17, 2025
ccb5895
refactor: updated some unit tests
Jul 18, 2025
6da13ea
Merge branch 'dev' into sdk-migrations-2.5
Jul 18, 2025
b4cc448
chore: post merge removals
Jul 18, 2025
c780d67
refactor: unit tests
Jul 18, 2025
953656f
fix: lint, api, yarn
Jul 18, 2025
558de09
fix: init, delete, and push commands
Aug 5, 2025
da54da4
fix: publish, add hosting
Aug 6, 2025
9d833a1
chore: debugging
Aug 6, 2025
5f9abfc
fix: pull
Aug 7, 2025
3bf519a
fix: push and pull
Aug 7, 2025
2c57be9
fix: pull and debugging
Aug 7, 2025
94c5f03
Merge branch 'dev' into sdk-migrations-2.5
Aug 7, 2025
c353d50
chore: debugging
Aug 8, 2025
30d0f93
fix: update
Aug 8, 2025
dafab7a
fix: typing
Aug 9, 2025
4ed8adc
refactor: switch credentials object over to sdk v3 object
Aug 12, 2025
de651f2
fix: sdk v3 creds config in tests
Aug 12, 2025
ff3706b
fix: legacy sdk v2 creds, api
Aug 12, 2025
7164c6a
fix: feedback
Aug 19, 2025
8033901
fix: update types to 20, function mocks
Aug 19, 2025
237554d
fix: test
Aug 19, 2025
d10ec78
fix: another test
Aug 19, 2025
af3919b
refactor: console hosting
Aug 20, 2025
56c3fed
chore: fix yarn and debugging
Aug 20, 2025
5074543
fix: function secrets
Aug 21, 2025
f297ef5
fix: secrets
Aug 21, 2025
e85dea9
chore: debugging
Aug 21, 2025
033b301
chore: debugging
Aug 22, 2025
2521f89
chore: update tests
Aug 22, 2025
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"@types/glob": "^7.1.1",
"@types/jest": "^29.0.0",
"@types/js-yaml": "^4.0.0",
"@types/node": "^18.16.1",
"@types/node": "^20.9.0",
"@types/yargs": "^17",
"@typescript-eslint/eslint-plugin": "^5.34.0",
"@typescript-eslint/parser": "^5.34.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/amplify-appsync-simulator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@aws-amplify/amplify-graphiql-explorer": "2.6.2",
"@types/cors": "^2.8.6",
"@types/express": "^4.17.3",
"@types/node": "^12.12.6",
"@types/node": "^20.9.0",
"@types/ws": "^8.2.2",
"jose": "^5.2.0"
},
Expand Down
1 change: 1 addition & 0 deletions packages/amplify-category-function/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@aws-amplify/amplify-environment-parameters": "1.9.20",
"@aws-amplify/amplify-function-plugin-interface": "1.12.1",
"@aws-amplify/amplify-prompts": "2.8.7",
"@aws-sdk/client-ssm": "^3.624.0",
"archiver": "^7.0.1",
"aws-sdk": "^2.1464.0",
"chalk": "^4.1.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { $TSContext } from '@aws-amplify/amplify-cli-core';
import type { SSM } from 'aws-sdk';
import {
DeleteParameterCommand,
DeleteParametersCommand,
GetParametersByPathCommand,
GetParametersByPathResult,
GetParametersCommand,
PutParameterCommand,
SSMClient,
} from '@aws-sdk/client-ssm';

/**
* Wrapper around SSM SDK calls
Expand All @@ -14,7 +22,7 @@ export class SSMClientWrapper {
return SSMClientWrapper.instance;
};

private constructor(private readonly ssmClient: SSM) {}
private constructor(private readonly ssmClient: SSMClient) {}

/**
* Returns a list of secret name value pairs
Expand All @@ -23,12 +31,12 @@ export class SSMClientWrapper {
if (!secretNames || secretNames.length === 0) {
return [];
}
const result = await this.ssmClient
.getParameters({
const result = await this.ssmClient.send(
new GetParametersCommand({
Names: secretNames,
WithDecryption: true,
})
.promise();
}),
);

return result?.Parameters?.map(({ Name, Value }) => ({ secretName: Name, secretValue: Value }));
};
Expand All @@ -40,8 +48,8 @@ export class SSMClientWrapper {
let NextToken;
const accumulator: string[] = [];
do {
const result: SSM.GetParametersByPathResult = await this.ssmClient
.getParametersByPath({
const result: GetParametersByPathResult = await this.ssmClient.send(
new GetParametersByPathCommand({
Path: secretPath,
MaxResults: 10,
ParameterFilters: [
Expand All @@ -52,8 +60,8 @@ export class SSMClientWrapper {
},
],
NextToken,
})
.promise();
}),
);

if (Array.isArray(result?.Parameters)) {
accumulator.push(...result.Parameters.filter((param) => param?.Name !== undefined).map((param) => param.Name));
Expand All @@ -68,39 +76,40 @@ export class SSMClientWrapper {
* Sets the given secretName to the secretValue. If secretName is already present, it is overwritten.
*/
setSecret = async (secretName: string, secretValue: string): Promise<void> => {
await this.ssmClient
.putParameter({
await this.ssmClient.send(
new PutParameterCommand({
Name: secretName,
Value: secretValue,
Type: 'SecureString',
Overwrite: true,
})
.promise();
}),
);
};

/**
* Deletes secretName. If it already doesn't exist, this is treated as success. All other errors will throw.
*/
deleteSecret = async (secretName: string): Promise<void> => {
await this.ssmClient
.deleteParameter({
Name: secretName,
})
.promise()
.catch((err) => {
if (err.code !== 'ParameterNotFound') {
// if the value didn't exist in the first place, consider it deleted
throw err;
}
});
try {
await this.ssmClient.send(
new DeleteParameterCommand({
Name: secretName,
}),
);
} catch (err) {
if (err.code !== 'ParameterNotFound') {
// if the value didn't exist in the first place, consider it deleted
throw err;
}
}
};

/**
* Deletes all secrets in secretNames
*/
deleteSecrets = async (secretNames: string[]): Promise<void> => {
try {
await this.ssmClient.deleteParameters({ Names: secretNames }).promise();
await this.ssmClient.send(new DeleteParametersCommand({ Names: secretNames }));
} catch (err) {
// if the value didn't exist in the first place, consider it deleted
if (err.code !== 'ParameterNotFound') {
Expand All @@ -110,8 +119,8 @@ export class SSMClientWrapper {
};
}

const getSSMClient = async (context: $TSContext): Promise<SSM> => {
const { client } = await context.amplify.invokePluginMethod<{ client: SSM }>(
const getSSMClient = async (context: $TSContext): Promise<SSMClient> => {
const { client } = await context.amplify.invokePluginMethod<{ client: SSMClient }>(
context,
'awscloudformation',
undefined,
Expand Down
3 changes: 2 additions & 1 deletion packages/amplify-category-storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
"@aws-amplify/amplify-prompts": "2.8.7",
"@aws-amplify/amplify-util-import": "2.8.3",
"@aws-amplify/cli-extensibility-helper": "3.0.39",
"@aws-sdk/client-dynamodb": "^3.515.0",
"@aws-sdk/client-s3": "^3.515.0",
"amplify-headless-interface": "1.17.8",
"amplify-util-headless-input": "1.9.19",
"aws-cdk-lib": "~2.189.1",
"aws-sdk": "^2.1464.0",
"chalk": "^4.1.1",
"constructs": "^10.0.5",
"enquirer": "^2.3.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@aws-amplify/amplify-cli-core';
import { printer } from '@aws-amplify/amplify-prompts';
import { IS3Service } from '@aws-amplify/amplify-util-import';
import { Bucket } from 'aws-sdk/clients/s3';
import { Bucket } from '@aws-sdk/client-s3';
import Enquirer from 'enquirer';
import _ from 'lodash';
import { v4 as uuid } from 'uuid';
Expand Down Expand Up @@ -115,7 +115,7 @@ const importServiceWalkthrough = async (
const bucketList = await s3.listBuckets();

// Return if no User Pools found in the project's region
if (_.isEmpty(bucketList)) {
if (bucketList.length == 0) {
printer.info(importMessages.NoS3BucketsToImport);
return undefined;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { $TSContext, $TSObject } from '@aws-amplify/amplify-cli-core';
import { IDynamoDBService, IS3Service } from '@aws-amplify/amplify-util-import';
import { Bucket } from 'aws-sdk/clients/s3';
import { TableDescription } from 'aws-sdk/clients/dynamodb';
import { Bucket } from '@aws-sdk/client-s3';
import { TableDescription } from '@aws-sdk/client-dynamodb';

// parameters.json
export type S3ResourceParameters = {
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 @@ -68,7 +68,7 @@
"@types/hjson": "^2.4.2",
"@types/json-schema": "^7.0.5",
"@types/lodash": "^4.14.149",
"@types/node": "^12.12.6",
"@types/node": "^20.9.0",
"@types/rimraf": "^3.0.0",
"@types/uuid": "^8.0.0",
"@types/yarnpkg__lockfile": "^1.1.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ describe('roundtrip CFN Templates to object and back', () => {

const writtenYaml = fs_mock.writeFileSync.mock.calls[0][1];

(fs_mock.readFile as unknown as jest.MockedFunction<TwoArgReadFile>).mockResolvedValueOnce(writtenYaml);
(fs_mock.readFile as unknown as jest.MockedFunction<TwoArgReadFile>).mockResolvedValueOnce(writtenYaml as string);

const roundtrippedYaml = readCFNTemplate(testPath);

Expand Down
3 changes: 2 additions & 1 deletion packages/amplify-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"@aws-amplify/amplify-util-mock": "5.10.16",
"@aws-amplify/amplify-util-uibuilder": "1.14.20",
"@aws-cdk/cloudformation-diff": "~2.68.0",
"@aws-sdk/client-amplify": "^3.624.0",
"amplify-codegen": "^4.10.3",
"amplify-dotnet-function-runtime-provider": "2.1.5",
"amplify-go-function-runtime-provider": "2.3.52",
Expand Down Expand Up @@ -112,7 +113,7 @@
"@types/fs-extra": "^8.0.1",
"@types/glob": "^7.1.1",
"@types/gunzip-maybe": "^1.4.0",
"@types/node": "^12.12.6",
"@types/node": "^20.9.0",
"@types/node-fetch": "^2.6.12",
"@types/progress": "^2.0.3",
"@types/promise-sequential": "^1.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,29 @@ jest.mock('@aws-amplify/amplify-cli-core', () => ({
jest.mock('../../../extensions/amplify-helpers/get-plugin-instance', () => ({
getPluginInstance: jest.fn().mockReturnValue({
getConfiguredAmplifyClient: jest.fn().mockResolvedValue({
listBackendEnvironments: jest.fn().mockReturnValue({
promise: jest
.fn()
.mockImplementationOnce(() => ({
send: jest
.fn()
// first ListBackendEnv Call
.mockImplementationOnce(() =>
Promise.resolve({
backendEnvironments: [],
}))
.mockImplementationOnce(() => {
throw new Error('listBackendEnvironments error');
})
.mockImplementationOnce(() => {
// eslint-disable-next-line no-throw-literal
throw {
name: 'BucketNotFoundError',
message: 'Bucket not found',
link: 'https://docs.aws.amazon.com/',
};
}),
}),
deleteApp: jest.fn().mockReturnValue({
promise: jest.fn().mockResolvedValue(true),
}),
)
// DeleteApp call
.mockImplementationOnce(() => Promise.resolve(true))
// second ListBackendEnv Call
.mockImplementationOnce(() => {
throw new Error('listBackendEnvironments error');
})
// third ListBackendEnv Call
.mockImplementationOnce(() => {
// eslint-disable-next-line no-throw-literal
throw {
name: 'BucketNotFoundError',
message: 'Bucket not found',
link: 'https://docs.aws.amazon.com/',
};
}),
}),
}),
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('encryption helper', () => {
decipher.setAuthTag(tag);

// encrypt the given text
const decrypted = decipher.update(text, 'binary', 'utf8') + decipher.final('utf8');
const decrypted = decipher.update(text) + decipher.final('utf8');
expect(decrypted).toEqual(plainText.toString('utf8'));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import ora from 'ora';
import chalk from 'chalk';
import { ListBackendEnvironmentsCommand, DeleteAppCommand } from '@aws-sdk/client-amplify';
import { FeatureFlags, $TSContext, AmplifyFault } from '@aws-amplify/amplify-cli-core';
import { printer, prompter } from '@aws-amplify/amplify-prompts';
import { removeEnvFromCloud } from './remove-env-from-cloud';
Expand Down Expand Up @@ -37,7 +38,7 @@ export const deleteProject = async (context: $TSContext): Promise<void> => {
const amplifyClient = await awsCloudPlugin.getConfiguredAmplifyClient(context, {});
const environments = await amplifyBackendEnvironments(amplifyClient, appId);
if (environments.length === 0) {
await amplifyClient.deleteApp({ appId }).promise();
await amplifyClient.send(new DeleteAppCommand({ appId }));
} else {
printer.warn('Amplify App cannot be deleted, other environments still linked to Application');
}
Expand Down Expand Up @@ -77,11 +78,7 @@ const removeLocalAmplifyDir = (context: $TSContext): void => {
};

const amplifyBackendEnvironments = async (client, appId): Promise<string[]> => {
const data = await client
.listBackendEnvironments({
appId,
})
.promise();
const data = await client.send(new ListBackendEnvironmentsCommand({ appId }));
return data.backendEnvironments;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export const pushResources = async (
await onCategoryOutputsChange(context, currentAmplifyMeta);
} catch (err) {
// TODO PL: this needs to be removed once the api category is using the new amplify error class
console.log(err);
const isAuthError = isValidGraphQLAuthError(err.message);
if (isAuthError) {
retryPush = await handleValidGraphQLAuthError(context, err.message);
Expand Down
2 changes: 2 additions & 0 deletions packages/amplify-console-hosting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"dependencies": {
"@aws-amplify/amplify-cli-core": "4.4.2",
"@aws-amplify/amplify-environment-parameters": "1.9.20",
"@aws-sdk/client-amplify": "^3.624.0",
"@aws-sdk/client-s3": "^3.624.0",
"archiver": "^7.0.1",
"aws-sdk": "^2.1692.0",
"chalk": "^4.1.1",
Expand Down
9 changes: 5 additions & 4 deletions packages/amplify-console-hosting/src/hosting/cicd/enable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const clientFactory = require('../../utils/client-factory');
const pathManager = require('../../utils/path-manager');
const ValidationError = require('../../error/validation-error').default;
const statusMod = require('../index');
const { ListBranchesCommand } = require('@aws-sdk/client-amplify');

/**
* Entry point to enable CI/CD hosting
Expand Down Expand Up @@ -41,11 +42,11 @@ async function enable(context) {

async function validateCICDApp(context, appId) {
const amplifyClient = await clientFactory.getAmplifyClient(context);
const result = await amplifyClient
.listBranches({
const result = await amplifyClient.send(
new ListBranchesCommand({
appId,
})
.promise();
}),
);
if (result.branches.length === 0) {
throw new ValidationError("No hosting URL found. Run 'amplify add hosting' again to set up hosting with Amplify Console.");
}
Expand Down
3 changes: 2 additions & 1 deletion packages/amplify-console-hosting/src/hosting/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const clientFactory = require('../utils/client-factory');
const tableUtils = require('../utils/table-utils');
const { ensureEnvParamManager } = require('@aws-amplify/amplify-environment-parameters');
const { spinner } = require('@aws-amplify/amplify-cli-core');
const { ListBranchesCommand } = require('@aws-sdk/client-amplify');

const HELP_INFO_PLACE_HOLDER =
'Manual deployment allows you to publish your web app to the Amplify Console without connecting a Git provider. Continuous deployment allows you to publish changes on every code commit by connecting your GitHub, Bitbucket, GitLab, or AWS CodeCommit repositories.';
Expand Down Expand Up @@ -166,7 +167,7 @@ function isHostingEnabled(context) {
async function isFrontendCreatedOnline(context) {
const appId = utils.getAppIdForCurrEnv(context);
const amplifyClient = await clientFactory.getAmplifyClient(context);
const result = await amplifyClient.listBranches({ appId }).promise();
const result = await amplifyClient.send(new ListBranchesCommand({ appId }));
if (result.branches.length > 0) {
return true;
} else {
Expand Down
Loading
Loading