Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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-e2e-tests/functions/titlecase.pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ verify_ssl = true
titlecase = "==0.12.0"

[requires]
python_version = "3.13"
python_version = "3.8"
6 changes: 3 additions & 3 deletions packages/amplify-e2e-tests/src/__tests__/layer-2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,13 +371,13 @@ describe('amplify add lambda layer with changes', () => {
add python layer
add files in opt
push
remove lib/python3.13/site-packages (simulate gitignore),
remove lib/python3.8/site-packages (simulate gitignore),
amplify status -> no change
delete Pipfile.lock
amplify status -> update
push
-> should not create layer version, (it should force a pip install),
lib/python3.13/site-packages should exist with content, push should succeed
lib/python3.8/site-packages should exist with content, push should succeed
*/

it('add python layer, remove lock file, site-packages, verify status, push', async () => {
Expand Down Expand Up @@ -405,7 +405,7 @@ describe('amplify add lambda layer with changes', () => {

const firstArn = getCurrentLayerArnFromMeta(projRoot, { layerName, projName });

// 1. Remove lib/python3.13/site-packages
// 1. Remove lib/python3.8/site-packages
// 2. Check status: No Change
const layerPath = path.join(
projRoot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import {
ListUserPoolsRequest,
} from '@aws-sdk/client-cognito-identity-provider';
import { ICognitoUserPoolService } from '@aws-amplify/amplify-util-import';
import { AwsSecrets, loadConfiguration } from '../configuration-manager';
import { AwsV3Secrets, loadConfiguration } from '../configuration-manager';
import { fileLogger } from '../utils/aws-logger';
import { pagedAWSCall } from './paged-call';
const logger = fileLogger('CognitoUserPoolService');

export const createCognitoUserPoolService = async (context: $TSContext, options: $TSAny): Promise<CognitoUserPoolService> => {
let credentials: AwsSecrets = {};
let credentials: AwsV3Secrets = {};

try {
credentials = await loadConfiguration(context);
Expand All @@ -38,12 +38,14 @@ export const createCognitoUserPoolService = async (context: $TSContext, options:
}

const cognito = new CognitoIdentityProviderClient({
...credentials,
...options,
credentials: {
accessKeyId: credentials.accessKeyId,
secretAccessKey: credentials.secretAccessKey,
sessionToken: credentials.sessionToken,
expiration: credentials.expiration,
},
region: credentials.region,
});

return new CognitoUserPoolService(cognito);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import {
ListIdentityPoolsResponse,
ListIdentityPoolsInput,
} from '@aws-sdk/client-cognito-identity';
import { AwsSecrets, loadConfiguration } from '../configuration-manager';
import { AwsV3Secrets, loadConfiguration } from '../configuration-manager';
import { pagedAWSCall } from './paged-call';

export const createIdentityPoolService = async (context: $TSContext, options: $TSAny): Promise<IdentityPoolService> => {
let credentials: AwsSecrets = {};
let credentials: AwsV3Secrets = {};

try {
credentials = await loadConfiguration(context);
Expand All @@ -23,12 +23,14 @@ export const createIdentityPoolService = async (context: $TSContext, options: $T
}

const cognitoIdentity = new CognitoIdentityClient({
...credentials,
...options,
credentials: {
accessKeyId: credentials.accessKeyId,
secretAccessKey: credentials.secretAccessKey,
sessionToken: credentials.sessionToken,
expiration: credentials.expiration,
},
region: credentials.region,
});

return new IdentityPoolService(cognitoIdentity);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { $TSContext } from '@aws-amplify/amplify-cli-core';
import { CognitoIdentityProviderClient, CognitoIdentityProviderClientConfig } from '@aws-sdk/client-cognito-identity-provider';
import { NodeHttpHandler } from '@smithy/node-http-handler';
import { AwsSecrets, loadConfiguration } from '../configuration-manager';
import { AwsV3Secrets, loadConfiguration } from '../configuration-manager';
import { proxyAgent } from './aws-globals';

export class CognitoUserPoolClientProvider {
Expand All @@ -10,7 +10,7 @@ export class CognitoUserPoolClientProvider {

static async getInstance(context: $TSContext, options = {}): Promise<CognitoUserPoolClientProvider> {
if (!CognitoUserPoolClientProvider.instance) {
let cred: AwsSecrets = {};
let cred: AwsV3Secrets = {};
try {
cred = await loadConfiguration(context);
} catch (e) {
Expand All @@ -22,14 +22,16 @@ export class CognitoUserPoolClientProvider {
return CognitoUserPoolClientProvider.instance;
}

constructor(creds: AwsSecrets, options = {}) {
constructor(creds: AwsV3Secrets, options = {}) {
const clientConfig: CognitoIdentityProviderClientConfig = {
...creds,
...options,
credentials: {
accessKeyId: creds.accessKeyId,
secretAccessKey: creds.secretAccessKey,
sessionToken: creds.sessionToken,
expiration: creds.expiration,
},
region: creds.region,
requestHandler: new NodeHttpHandler({
httpAgent: proxyAgent(),
httpsAgent: proxyAgent(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { $TSContext } from '@aws-amplify/amplify-cli-core';
import { LocationClient } from '@aws-sdk/client-location';
import { NodeHttpHandler } from '@smithy/node-http-handler';
import { AwsSecrets, loadConfiguration } from '../configuration-manager';
import { AwsV3Secrets, loadConfiguration } from '../configuration-manager';
import { proxyAgent } from './aws-globals';

export class LocationService {
Expand All @@ -10,7 +10,7 @@ export class LocationService {

static async getInstance(context: $TSContext, options = {}): Promise<LocationService> {
if (!LocationService.instance) {
let cred: AwsSecrets = {};
let cred: AwsV3Secrets = {};
try {
cred = await loadConfiguration(context);
} catch (e) {
Expand All @@ -21,14 +21,15 @@ export class LocationService {
return LocationService.instance;
}

private constructor(cred: AwsSecrets, options = {}) {
private constructor(cred: AwsV3Secrets, options = {}) {
this.client = new LocationClient({
...cred,
...options,
credentials: {
accessKeyId: cred.accessKeyId,
secretAccessKey: cred.secretAccessKey,
sessionToken: cred.sessionToken,
},
region: cred.region,
requestHandler: new NodeHttpHandler({
httpAgent: proxyAgent(),
httpsAgent: proxyAgent(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ export interface AwsSecrets {
region?: string;
}

export interface AwsV3Secrets {
accessKeyId?: string;
secretAccessKey?: string;
sessionToken?: string;
expiration?: Date;
region?: string;
}

const defaultAWSConfig: AwsConfig = {
useProfile: true,
profileName: 'default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ verify_ssl = true
[packages]

[requires]
python_version = "3.13"
python_version = "3.8"
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const functionRuntimeContributorFactory: FunctionRuntimeContributorFactor
runtime: {
name: 'Python',
value: 'python',
cloudTemplateValue: 'python3.13',
cloudTemplateValue: 'python3.8',
defaultHandler: 'index.handler',
layerExecutablePath: 'python',
layerDefaultFiles: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ verify_ssl = true
src = {editable = true, path = "./src"}

[requires]
python_version = "3.13"
python_version = "3.8"
3 changes: 2 additions & 1 deletion scripts/view-test-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ function playTestArtifact {


local subfolders=("$temp_dir"/*/)
if [ ${#subfolders[@]} -eq 1 ]; then
# Check if glob expansion actually found directories
if [ ${#subfolders[@]} -eq 1 ] && [ -d "${subfolders[0]}" ]; then
cd "${subfolders[0]}" || exit 1
else
cd "$temp_dir" || exit 1
Expand Down
Loading