From 50b8c071cd03da6351b546cd37c27212881c2f52 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Thu, 25 Sep 2025 19:08:53 -0400 Subject: [PATCH 01/20] fix: e2e tests --- packages/amplify-e2e-tests/src/__tests__/auth_2f.test.ts | 1 + .../amplify-e2e-tests/src/__tests__/geo-add-a.test.ts | 1 + .../src/aws-utils/CognitoUserPoolService.ts | 6 ++++-- .../src/aws-utils/IdentityPoolService.ts | 6 ++++-- .../src/aws-utils/aws-cognito-client.ts | 8 +++++--- .../src/aws-utils/aws-location-service.ts | 8 +++++--- .../src/configuration-manager.ts | 8 ++++++++ scripts/view-test-artifacts.sh | 3 ++- 8 files changed, 30 insertions(+), 11 deletions(-) diff --git a/packages/amplify-e2e-tests/src/__tests__/auth_2f.test.ts b/packages/amplify-e2e-tests/src/__tests__/auth_2f.test.ts index f316126f527..6b8a89e0ea7 100644 --- a/packages/amplify-e2e-tests/src/__tests__/auth_2f.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/auth_2f.test.ts @@ -20,6 +20,7 @@ const defaultsSettings = { describe('amplify add auth...', () => { let projRoot: string; beforeEach(async () => { + process.env.AMPLIFY_ENABLE_DEBUG_OUTPUT = 'true'; projRoot = await createNewProjectDir('auth'); }); diff --git a/packages/amplify-e2e-tests/src/__tests__/geo-add-a.test.ts b/packages/amplify-e2e-tests/src/__tests__/geo-add-a.test.ts index 1791a784543..3ea74a2bdb1 100644 --- a/packages/amplify-e2e-tests/src/__tests__/geo-add-a.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/geo-add-a.test.ts @@ -22,6 +22,7 @@ describe('amplify geo add a', () => { let projRoot: string; beforeEach(async () => { projRoot = await createNewProjectDir('geo-add-test'); + process.env.AMPLIFY_ENABLE_DEBUG_OUTPUT = 'true'; }); afterEach(async () => { diff --git a/packages/amplify-provider-awscloudformation/src/aws-utils/CognitoUserPoolService.ts b/packages/amplify-provider-awscloudformation/src/aws-utils/CognitoUserPoolService.ts index d81c4e412d3..9ea5dccdca1 100644 --- a/packages/amplify-provider-awscloudformation/src/aws-utils/CognitoUserPoolService.ts +++ b/packages/amplify-provider-awscloudformation/src/aws-utils/CognitoUserPoolService.ts @@ -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 => { - let credentials: AwsSecrets = {}; + let credentials: AwsV3Secrets = {}; try { credentials = await loadConfiguration(context); @@ -42,6 +42,8 @@ export const createCognitoUserPoolService = async (context: $TSContext, options: credentials: { accessKeyId: credentials.accessKeyId, secretAccessKey: credentials.secretAccessKey, + sessionToken: credentials.sessionToken, + expiration: credentials.expiration, }, region: credentials.region, }); diff --git a/packages/amplify-provider-awscloudformation/src/aws-utils/IdentityPoolService.ts b/packages/amplify-provider-awscloudformation/src/aws-utils/IdentityPoolService.ts index 0987cc12d5d..6b61e636b67 100644 --- a/packages/amplify-provider-awscloudformation/src/aws-utils/IdentityPoolService.ts +++ b/packages/amplify-provider-awscloudformation/src/aws-utils/IdentityPoolService.ts @@ -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 => { - let credentials: AwsSecrets = {}; + let credentials: AwsV3Secrets = {}; try { credentials = await loadConfiguration(context); @@ -27,6 +27,8 @@ export const createIdentityPoolService = async (context: $TSContext, options: $T credentials: { accessKeyId: credentials.accessKeyId, secretAccessKey: credentials.secretAccessKey, + sessionToken: credentials.sessionToken, + expiration: credentials.expiration, }, region: credentials.region, }); diff --git a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-cognito-client.ts b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-cognito-client.ts index f20ca33e180..8bd01773691 100644 --- a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-cognito-client.ts +++ b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-cognito-client.ts @@ -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 { @@ -10,7 +10,7 @@ export class CognitoUserPoolClientProvider { static async getInstance(context: $TSContext, options = {}): Promise { if (!CognitoUserPoolClientProvider.instance) { - let cred: AwsSecrets = {}; + let cred: AwsV3Secrets = {}; try { cred = await loadConfiguration(context); } catch (e) { @@ -22,12 +22,14 @@ export class CognitoUserPoolClientProvider { return CognitoUserPoolClientProvider.instance; } - constructor(creds: AwsSecrets, options = {}) { + constructor(creds: AwsV3Secrets, options = {}) { const clientConfig: CognitoIdentityProviderClientConfig = { ...options, credentials: { accessKeyId: creds.accessKeyId, secretAccessKey: creds.secretAccessKey, + sessionToken: creds.sessionToken, + expiration: creds.expiration, }, region: creds.region, requestHandler: new NodeHttpHandler({ diff --git a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts index 00b5085cc5b..539ba60743b 100644 --- a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts +++ b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts @@ -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 { @@ -10,7 +10,7 @@ export class LocationService { static async getInstance(context: $TSContext, options = {}): Promise { if (!LocationService.instance) { - let cred: AwsSecrets = {}; + let cred: AwsV3Secrets = {}; try { cred = await loadConfiguration(context); } catch (e) { @@ -21,12 +21,14 @@ export class LocationService { return LocationService.instance; } - private constructor(cred: AwsSecrets, options = {}) { + private constructor(cred: AwsV3Secrets, options = {}) { this.client = new LocationClient({ ...options, credentials: { accessKeyId: cred.accessKeyId, secretAccessKey: cred.secretAccessKey, + sessionToken: cred.sessionToken, + expiration: cred.expiration, }, region: cred.region, requestHandler: new NodeHttpHandler({ diff --git a/packages/amplify-provider-awscloudformation/src/configuration-manager.ts b/packages/amplify-provider-awscloudformation/src/configuration-manager.ts index c67391c769c..23dd661f1a8 100644 --- a/packages/amplify-provider-awscloudformation/src/configuration-manager.ts +++ b/packages/amplify-provider-awscloudformation/src/configuration-manager.ts @@ -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', diff --git a/scripts/view-test-artifacts.sh b/scripts/view-test-artifacts.sh index 17c3e481e1d..4e68101e8ec 100755 --- a/scripts/view-test-artifacts.sh +++ b/scripts/view-test-artifacts.sh @@ -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 From 7a7b022830de293002bbe46a9af2435802213af8 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Fri, 26 Sep 2025 10:50:17 -0400 Subject: [PATCH 02/20] chore: debugging --- packages/amplify-e2e-tests/src/__tests__/auth_2f.test.ts | 1 - packages/amplify-e2e-tests/src/__tests__/geo-import-1b.test.ts | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify-e2e-tests/src/__tests__/auth_2f.test.ts b/packages/amplify-e2e-tests/src/__tests__/auth_2f.test.ts index 6b8a89e0ea7..f316126f527 100644 --- a/packages/amplify-e2e-tests/src/__tests__/auth_2f.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/auth_2f.test.ts @@ -20,7 +20,6 @@ const defaultsSettings = { describe('amplify add auth...', () => { let projRoot: string; beforeEach(async () => { - process.env.AMPLIFY_ENABLE_DEBUG_OUTPUT = 'true'; projRoot = await createNewProjectDir('auth'); }); diff --git a/packages/amplify-e2e-tests/src/__tests__/geo-import-1b.test.ts b/packages/amplify-e2e-tests/src/__tests__/geo-import-1b.test.ts index 47ff5d9c00e..101f993f570 100644 --- a/packages/amplify-e2e-tests/src/__tests__/geo-import-1b.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/geo-import-1b.test.ts @@ -22,6 +22,7 @@ describe('amplify geo import', () => { let collectionName: string; let region: string; beforeEach(async () => { + process.env.AMPLIFY_ENABLE_DEBUG_OUTPUT = 'true'; projRoot = await createNewProjectDir('geo-import-test'); await initJSProjectWithProfile(projRoot, {}); await addAuthWithDefault(projRoot); From 061bdd74f446eb3ed02e4c218332b1bbd5d87119 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Fri, 26 Sep 2025 10:52:45 -0400 Subject: [PATCH 03/20] chore: moe debugging --- packages/amplify-e2e-tests/src/__tests__/geo-add-a.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/amplify-e2e-tests/src/__tests__/geo-add-a.test.ts b/packages/amplify-e2e-tests/src/__tests__/geo-add-a.test.ts index 3ea74a2bdb1..1791a784543 100644 --- a/packages/amplify-e2e-tests/src/__tests__/geo-add-a.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/geo-add-a.test.ts @@ -22,7 +22,6 @@ describe('amplify geo add a', () => { let projRoot: string; beforeEach(async () => { projRoot = await createNewProjectDir('geo-add-test'); - process.env.AMPLIFY_ENABLE_DEBUG_OUTPUT = 'true'; }); afterEach(async () => { From 019aceaf6706f807299381580e84040c5b098ec3 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Fri, 26 Sep 2025 13:33:26 -0400 Subject: [PATCH 04/20] fix: options --- .../src/aws-utils/aws-location-service.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts index 539ba60743b..8df7d0c8fee 100644 --- a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts +++ b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts @@ -22,6 +22,12 @@ export class LocationService { } private constructor(cred: AwsV3Secrets, options = {}) { + // this is a temporary workaround until PR#14236 is merged + let region; + if (JSON.stringify(options) === '{}') { + region = (options as { region: string }).region ? (options as { region: string }).region : cred.region; + } + this.client = new LocationClient({ ...options, credentials: { @@ -30,7 +36,7 @@ export class LocationService { sessionToken: cred.sessionToken, expiration: cred.expiration, }, - region: cred.region, + region: region, requestHandler: new NodeHttpHandler({ httpAgent: proxyAgent(), httpsAgent: proxyAgent(), From dc222fd2461456e9db44405bb780209e228b8f5b Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Fri, 26 Sep 2025 14:58:59 -0400 Subject: [PATCH 05/20] chore: revert geo --- .../src/aws-utils/aws-location-service.ts | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts index 8df7d0c8fee..01b2186c836 100644 --- a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts +++ b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts @@ -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 { AwsV3Secrets, loadConfiguration } from '../configuration-manager'; +import { AwsSecrets, loadConfiguration } from '../configuration-manager'; import { proxyAgent } from './aws-globals'; export class LocationService { @@ -10,7 +10,7 @@ export class LocationService { static async getInstance(context: $TSContext, options = {}): Promise { if (!LocationService.instance) { - let cred: AwsV3Secrets = {}; + let cred: AwsSecrets = {}; try { cred = await loadConfiguration(context); } catch (e) { @@ -21,22 +21,10 @@ export class LocationService { return LocationService.instance; } - private constructor(cred: AwsV3Secrets, options = {}) { - // this is a temporary workaround until PR#14236 is merged - let region; - if (JSON.stringify(options) === '{}') { - region = (options as { region: string }).region ? (options as { region: string }).region : cred.region; - } - + private constructor(cred: AwsSecrets, options = {}) { this.client = new LocationClient({ + ...cred, ...options, - credentials: { - accessKeyId: cred.accessKeyId, - secretAccessKey: cred.secretAccessKey, - sessionToken: cred.sessionToken, - expiration: cred.expiration, - }, - region: region, requestHandler: new NodeHttpHandler({ httpAgent: proxyAgent(), httpsAgent: proxyAgent(), From 5407b58577323c0f3f123ae36f7d401123014aed Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Fri, 26 Sep 2025 15:06:29 -0400 Subject: [PATCH 06/20] fix: one more attempt --- .../src/aws-utils/aws-location-service.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts index 01b2186c836..04679fa9b39 100644 --- a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts +++ b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts @@ -25,6 +25,10 @@ export class LocationService { this.client = new LocationClient({ ...cred, ...options, + credentials: { + accessKeyId: cred.accessKeyId, + secretAccessKey: cred.secretAccessKey, + }, requestHandler: new NodeHttpHandler({ httpAgent: proxyAgent(), httpsAgent: proxyAgent(), From a08511601b1e6f1c2de0510675e2d16efabc018a Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Fri, 26 Sep 2025 16:33:26 -0400 Subject: [PATCH 07/20] fix: lets do this one more time --- .../src/aws-utils/aws-location-service.ts | 5 +++-- scripts/cloud-cli-utils.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts index 04679fa9b39..7554bb26664 100644 --- a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts +++ b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts @@ -10,7 +10,7 @@ export class LocationService { static async getInstance(context: $TSContext, options = {}): Promise { if (!LocationService.instance) { - let cred: AwsSecrets = {}; + let cred: AwsV3Secrets = {}; try { cred = await loadConfiguration(context); } catch (e) { @@ -21,13 +21,14 @@ 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, }, requestHandler: new NodeHttpHandler({ httpAgent: proxyAgent(), diff --git a/scripts/cloud-cli-utils.sh b/scripts/cloud-cli-utils.sh index d93c41a67cd..619f0e75874 100644 --- a/scripts/cloud-cli-utils.sh +++ b/scripts/cloud-cli-utils.sh @@ -14,7 +14,7 @@ function authenticate { if [[ -n $USE_FIDO_KEY ]] ; then mwinit -s -f else - mwinit + mwinit -o fi echo Loading account credentials for Account $account_number with Role: $role_name... ada cred update --profile="${profile_name}" --account="${account_number}" --role=${role_name} --provider=isengard --once From ed0471e21559b9bf8fe8378b36f2492726bc6f9a Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Fri, 26 Sep 2025 16:45:34 -0400 Subject: [PATCH 08/20] fix: v3secrets --- .../src/aws-utils/aws-location-service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts index 7554bb26664..7438e06d552 100644 --- a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts +++ b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts @@ -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 { From 96ef0a1d2cd7f18f21f58c48da94f56cefa17a57 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Mon, 29 Sep 2025 09:36:20 -0400 Subject: [PATCH 09/20] fix: install python 3.13 --- codebuild_specs/run_e2e_tests_linux.yml | 3 +++ scripts/cloud-cli-utils.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/codebuild_specs/run_e2e_tests_linux.yml b/codebuild_specs/run_e2e_tests_linux.yml index c20e7d02980..750e8a116e2 100644 --- a/codebuild_specs/run_e2e_tests_linux.yml +++ b/codebuild_specs/run_e2e_tests_linux.yml @@ -23,6 +23,9 @@ env: # mock value, Cognito validates the private key, this is an invalidated key. APPLE_PRIVATE_KEY_2: '----BEGIN PRIVATE KEY-----MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgIltgNsTgTfSzUadYiCS0VYtDDMFln/J8i1yJsSIw5g+gCgYIKoZIzj0DAQehRANCAASI8E0L/DhR/mIfTT07v3VwQu6q8I76lgn7kFhT0HvWoLuHKGQFcFkXXCgztgBrprzd419mUChAnKE6y89bWcNw----END PRIVATE KEY----' phases: + install: + runtime-verions: + python: 3.13 build: commands: # you can provide a codebuild source version to use old cache and skip all other jobs :) diff --git a/scripts/cloud-cli-utils.sh b/scripts/cloud-cli-utils.sh index 619f0e75874..d93c41a67cd 100644 --- a/scripts/cloud-cli-utils.sh +++ b/scripts/cloud-cli-utils.sh @@ -14,7 +14,7 @@ function authenticate { if [[ -n $USE_FIDO_KEY ]] ; then mwinit -s -f else - mwinit -o + mwinit fi echo Loading account credentials for Account $account_number with Role: $role_name... ada cred update --profile="${profile_name}" --account="${account_number}" --role=${role_name} --provider=isengard --once From c3a333e44e6c52c065251246c4aaf73ecb13d499 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Mon, 29 Sep 2025 09:57:06 -0400 Subject: [PATCH 10/20] chore: run prettier --- codebuild_specs/run_e2e_tests_linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codebuild_specs/run_e2e_tests_linux.yml b/codebuild_specs/run_e2e_tests_linux.yml index 750e8a116e2..6a774c1a943 100644 --- a/codebuild_specs/run_e2e_tests_linux.yml +++ b/codebuild_specs/run_e2e_tests_linux.yml @@ -23,8 +23,8 @@ env: # mock value, Cognito validates the private key, this is an invalidated key. APPLE_PRIVATE_KEY_2: '----BEGIN PRIVATE KEY-----MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgIltgNsTgTfSzUadYiCS0VYtDDMFln/J8i1yJsSIw5g+gCgYIKoZIzj0DAQehRANCAASI8E0L/DhR/mIfTT07v3VwQu6q8I76lgn7kFhT0HvWoLuHKGQFcFkXXCgztgBrprzd419mUChAnKE6y89bWcNw----END PRIVATE KEY----' phases: - install: - runtime-verions: + install: + runtime-verions: python: 3.13 build: commands: From d4ada9c4faa8c2df8c91a785bbd5ba4cffd6de05 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Mon, 29 Sep 2025 11:37:58 -0400 Subject: [PATCH 11/20] chore: fix typo --- codebuild_specs/run_e2e_tests_linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/run_e2e_tests_linux.yml b/codebuild_specs/run_e2e_tests_linux.yml index 6a774c1a943..d4dd03da857 100644 --- a/codebuild_specs/run_e2e_tests_linux.yml +++ b/codebuild_specs/run_e2e_tests_linux.yml @@ -24,7 +24,7 @@ env: APPLE_PRIVATE_KEY_2: '----BEGIN PRIVATE KEY-----MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgIltgNsTgTfSzUadYiCS0VYtDDMFln/J8i1yJsSIw5g+gCgYIKoZIzj0DAQehRANCAASI8E0L/DhR/mIfTT07v3VwQu6q8I76lgn7kFhT0HvWoLuHKGQFcFkXXCgztgBrprzd419mUChAnKE6y89bWcNw----END PRIVATE KEY----' phases: install: - runtime-verions: + runtime-versions: python: 3.13 build: commands: From 891ad49557e13e516b5d5ffcd6459131f46cc706 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Mon, 29 Sep 2025 13:00:00 -0400 Subject: [PATCH 12/20] fix: install python 3.13 in specific tests --- codebuild_specs/run_e2e_tests_linux.yml | 3 --- .../src/__tests__/function_15.test.ts | 23 +++++++++++++++++++ .../src/__tests__/function_3a_python.test.ts | 23 +++++++++++++++++++ .../src/__tests__/function_4.test.ts | 23 +++++++++++++++++++ .../src/__tests__/layer-2.test.ts | 23 +++++++++++++++++++ 5 files changed, 92 insertions(+), 3 deletions(-) diff --git a/codebuild_specs/run_e2e_tests_linux.yml b/codebuild_specs/run_e2e_tests_linux.yml index d4dd03da857..c20e7d02980 100644 --- a/codebuild_specs/run_e2e_tests_linux.yml +++ b/codebuild_specs/run_e2e_tests_linux.yml @@ -23,9 +23,6 @@ env: # mock value, Cognito validates the private key, this is an invalidated key. APPLE_PRIVATE_KEY_2: '----BEGIN PRIVATE KEY-----MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgIltgNsTgTfSzUadYiCS0VYtDDMFln/J8i1yJsSIw5g+gCgYIKoZIzj0DAQehRANCAASI8E0L/DhR/mIfTT07v3VwQu6q8I76lgn7kFhT0HvWoLuHKGQFcFkXXCgztgBrprzd419mUChAnKE6y89bWcNw----END PRIVATE KEY----' phases: - install: - runtime-versions: - python: 3.13 build: commands: # you can provide a codebuild source version to use old cache and skip all other jobs :) diff --git a/packages/amplify-e2e-tests/src/__tests__/function_15.test.ts b/packages/amplify-e2e-tests/src/__tests__/function_15.test.ts index a49b6cd5677..e10879df720 100644 --- a/packages/amplify-e2e-tests/src/__tests__/function_15.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/function_15.test.ts @@ -10,10 +10,33 @@ import { overrideFunctionSrcNode, } from '@aws-amplify/amplify-e2e-core'; import { v4 as uuid } from 'uuid'; +import { execSync } from 'child_process'; describe('amplify push function cases:', () => { let projRoot: string; + // Install Python 3.13 if not available + beforeAll(async () => { + try { + execSync('python3.13 --version', { stdio: 'ignore' }); + } catch { + console.log('Installing Python 3.13...'); + execSync( + ` + wget -q https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tgz && + tar xzf Python-3.13.0.tgz && + cd Python-3.13.0 && + ./configure --enable-optimizations --quiet && + make -j$(nproc) --quiet && + sudo make altinstall --quiet && + cd .. && + rm -rf Python-3.13.0* + `, + { stdio: 'inherit' }, + ); + } + }); + beforeEach(async () => { projRoot = await createNewProjectDir('multiple-function-push'); }); diff --git a/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts b/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts index 4f622dd0483..982e38a9fa9 100644 --- a/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts @@ -9,6 +9,7 @@ import { deleteProjectDir, generateRandomShortId, } from '@aws-amplify/amplify-e2e-core'; +import { execSync } from 'child_process'; describe('python function tests', () => { const statusCode = 200; @@ -27,6 +28,28 @@ describe('python function tests', () => { let projRoot: string; let funcName: string; + // Install Python 3.13 if not available + beforeAll(async () => { + try { + execSync('python3.13 --version', { stdio: 'ignore' }); + } catch { + console.log('Installing Python 3.13...'); + execSync( + ` + wget -q https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tgz && + tar xzf Python-3.13.0.tgz && + cd Python-3.13.0 && + ./configure --enable-optimizations --quiet && + make -j$(nproc) --quiet && + sudo make altinstall --quiet && + cd .. && + rm -rf Python-3.13.0* + `, + { stdio: 'inherit' }, + ); + } + }); + beforeEach(async () => { projRoot = await createNewProjectDir('py-functions'); await initJSProjectWithProfile(projRoot, {}); diff --git a/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts b/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts index bada470a22b..8a1837e2616 100644 --- a/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts @@ -18,6 +18,7 @@ import { overrideLayerCodePython, } from '@aws-amplify/amplify-e2e-core'; import { v4 as uuid } from 'uuid'; +import { execSync } from 'child_process'; describe('add function with layers for runtime nodeJS', () => { let projRoot: string; @@ -27,6 +28,28 @@ describe('add function with layers for runtime nodeJS', () => { let functionName: string; const runtimes: LayerRuntime[] = ['nodejs']; + // Install Python 3.13 if not available + beforeAll(async () => { + try { + execSync('python3.13 --version', { stdio: 'ignore' }); + } catch { + console.log('Installing Python 3.13...'); + execSync( + ` + wget -q https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tgz && + tar xzf Python-3.13.0.tgz && + cd Python-3.13.0 && + ./configure --enable-optimizations --quiet && + make -j$(nproc) --quiet && + sudo make altinstall --quiet && + cd .. && + rm -rf Python-3.13.0* + `, + { stdio: 'inherit' }, + ); + } + }); + beforeEach(async () => { projRoot = await createNewProjectDir('functions'); await initJSProjectWithProfile(projRoot, {}); diff --git a/packages/amplify-e2e-tests/src/__tests__/layer-2.test.ts b/packages/amplify-e2e-tests/src/__tests__/layer-2.test.ts index 25ac819d747..010d15e520c 100644 --- a/packages/amplify-e2e-tests/src/__tests__/layer-2.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/layer-2.test.ts @@ -35,12 +35,35 @@ import { validatePushedVersion, } from '@aws-amplify/amplify-e2e-core'; import { v4 as uuid } from 'uuid'; +import { execSync } from 'child_process'; describe('amplify add lambda layer with changes', () => { let projRoot: string; let projName: string; const envName = 'integtest'; + // Install Python 3.13 if not available + beforeAll(async () => { + try { + execSync('python3.13 --version', { stdio: 'ignore' }); + } catch { + console.log('Installing Python 3.13...'); + execSync( + ` + wget -q https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tgz && + tar xzf Python-3.13.0.tgz && + cd Python-3.13.0 && + ./configure --enable-optimizations --quiet && + make -j$(nproc) --quiet && + sudo make altinstall --quiet && + cd .. && + rm -rf Python-3.13.0* + `, + { stdio: 'inherit' }, + ); + } + }); + beforeEach(async () => { projRoot = await createNewProjectDir('layers'); await initJSProjectWithProfile(projRoot, { envName }); From 6f19b9cd43bda5345e6193aa9ae51ab125a98857 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Mon, 29 Sep 2025 14:02:16 -0400 Subject: [PATCH 13/20] fix: final touches --- packages/amplify-e2e-tests/src/__tests__/geo-import-1b.test.ts | 1 - .../src/aws-utils/CognitoUserPoolService.ts | 2 +- .../src/aws-utils/IdentityPoolService.ts | 2 +- .../src/aws-utils/aws-cognito-client.ts | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/amplify-e2e-tests/src/__tests__/geo-import-1b.test.ts b/packages/amplify-e2e-tests/src/__tests__/geo-import-1b.test.ts index 101f993f570..47ff5d9c00e 100644 --- a/packages/amplify-e2e-tests/src/__tests__/geo-import-1b.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/geo-import-1b.test.ts @@ -22,7 +22,6 @@ describe('amplify geo import', () => { let collectionName: string; let region: string; beforeEach(async () => { - process.env.AMPLIFY_ENABLE_DEBUG_OUTPUT = 'true'; projRoot = await createNewProjectDir('geo-import-test'); await initJSProjectWithProfile(projRoot, {}); await addAuthWithDefault(projRoot); diff --git a/packages/amplify-provider-awscloudformation/src/aws-utils/CognitoUserPoolService.ts b/packages/amplify-provider-awscloudformation/src/aws-utils/CognitoUserPoolService.ts index 9ea5dccdca1..80eabee4804 100644 --- a/packages/amplify-provider-awscloudformation/src/aws-utils/CognitoUserPoolService.ts +++ b/packages/amplify-provider-awscloudformation/src/aws-utils/CognitoUserPoolService.ts @@ -38,6 +38,7 @@ export const createCognitoUserPoolService = async (context: $TSContext, options: } const cognito = new CognitoIdentityProviderClient({ + ...credentials, ...options, credentials: { accessKeyId: credentials.accessKeyId, @@ -45,7 +46,6 @@ export const createCognitoUserPoolService = async (context: $TSContext, options: sessionToken: credentials.sessionToken, expiration: credentials.expiration, }, - region: credentials.region, }); return new CognitoUserPoolService(cognito); diff --git a/packages/amplify-provider-awscloudformation/src/aws-utils/IdentityPoolService.ts b/packages/amplify-provider-awscloudformation/src/aws-utils/IdentityPoolService.ts index 6b61e636b67..94c72d59bdb 100644 --- a/packages/amplify-provider-awscloudformation/src/aws-utils/IdentityPoolService.ts +++ b/packages/amplify-provider-awscloudformation/src/aws-utils/IdentityPoolService.ts @@ -23,6 +23,7 @@ export const createIdentityPoolService = async (context: $TSContext, options: $T } const cognitoIdentity = new CognitoIdentityClient({ + ...credentials, ...options, credentials: { accessKeyId: credentials.accessKeyId, @@ -30,7 +31,6 @@ export const createIdentityPoolService = async (context: $TSContext, options: $T sessionToken: credentials.sessionToken, expiration: credentials.expiration, }, - region: credentials.region, }); return new IdentityPoolService(cognitoIdentity); diff --git a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-cognito-client.ts b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-cognito-client.ts index 8bd01773691..9c9aff93571 100644 --- a/packages/amplify-provider-awscloudformation/src/aws-utils/aws-cognito-client.ts +++ b/packages/amplify-provider-awscloudformation/src/aws-utils/aws-cognito-client.ts @@ -24,6 +24,7 @@ export class CognitoUserPoolClientProvider { constructor(creds: AwsV3Secrets, options = {}) { const clientConfig: CognitoIdentityProviderClientConfig = { + ...creds, ...options, credentials: { accessKeyId: creds.accessKeyId, @@ -31,7 +32,6 @@ export class CognitoUserPoolClientProvider { sessionToken: creds.sessionToken, expiration: creds.expiration, }, - region: creds.region, requestHandler: new NodeHttpHandler({ httpAgent: proxyAgent(), httpsAgent: proxyAgent(), From f79d511976abd1a3d33a20f7b134561f345c3317 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Mon, 29 Sep 2025 17:13:05 -0400 Subject: [PATCH 14/20] chore: update python installation --- packages/amplify-e2e-core/src/utils/index.ts | 1 + .../src/utils/install-python.ts | 12 ++++++++ .../src/__tests__/function_15.test.ts | 22 ++------------ .../src/__tests__/function_3a_python.test.ts | 21 ++------------ .../src/__tests__/function_4.test.ts | 29 ++++--------------- .../src/__tests__/layer-2.test.ts | 22 ++------------ 6 files changed, 25 insertions(+), 82 deletions(-) create mode 100644 packages/amplify-e2e-core/src/utils/install-python.ts diff --git a/packages/amplify-e2e-core/src/utils/index.ts b/packages/amplify-e2e-core/src/utils/index.ts index 31ce287d034..322804417cd 100644 --- a/packages/amplify-e2e-core/src/utils/index.ts +++ b/packages/amplify-e2e-core/src/utils/index.ts @@ -30,6 +30,7 @@ export * from './hooks'; export * from './git-operations'; export * from './help'; export * from './credentials-rotator'; +export * from './install-python'; /** * Whether the current environment is CircleCI or not diff --git a/packages/amplify-e2e-core/src/utils/install-python.ts b/packages/amplify-e2e-core/src/utils/install-python.ts new file mode 100644 index 00000000000..0d25778c35c --- /dev/null +++ b/packages/amplify-e2e-core/src/utils/install-python.ts @@ -0,0 +1,12 @@ +import { execSync } from 'child_process'; + +export const installPython313 = () => { + try { + execSync('python3.13 --version', { stdio: 'ignore' }); + } catch { + console.log('Installing Python 3.13...'); + execSync('sudo add-apt-repository ppa:deadsnakes/ppa -y && sudo apt-get update && sudo apt-get install -y python3.13', { + stdio: 'inherit', + }); + } +}; diff --git a/packages/amplify-e2e-tests/src/__tests__/function_15.test.ts b/packages/amplify-e2e-tests/src/__tests__/function_15.test.ts index e10879df720..ce923d39462 100644 --- a/packages/amplify-e2e-tests/src/__tests__/function_15.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/function_15.test.ts @@ -6,35 +6,17 @@ import { deleteProjectDir, generateRandomShortId, initJSProjectWithProfile, + installPython313, loadFunctionTestFile, overrideFunctionSrcNode, } from '@aws-amplify/amplify-e2e-core'; import { v4 as uuid } from 'uuid'; -import { execSync } from 'child_process'; describe('amplify push function cases:', () => { let projRoot: string; - // Install Python 3.13 if not available beforeAll(async () => { - try { - execSync('python3.13 --version', { stdio: 'ignore' }); - } catch { - console.log('Installing Python 3.13...'); - execSync( - ` - wget -q https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tgz && - tar xzf Python-3.13.0.tgz && - cd Python-3.13.0 && - ./configure --enable-optimizations --quiet && - make -j$(nproc) --quiet && - sudo make altinstall --quiet && - cd .. && - rm -rf Python-3.13.0* - `, - { stdio: 'inherit' }, - ); - } + installPython313(); }); beforeEach(async () => { diff --git a/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts b/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts index 982e38a9fa9..43b5eb480c7 100644 --- a/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts @@ -5,11 +5,11 @@ import { addFunction, functionMockAssert, functionCloudInvoke, + installPython313, createNewProjectDir, deleteProjectDir, generateRandomShortId, } from '@aws-amplify/amplify-e2e-core'; -import { execSync } from 'child_process'; describe('python function tests', () => { const statusCode = 200; @@ -30,24 +30,7 @@ describe('python function tests', () => { // Install Python 3.13 if not available beforeAll(async () => { - try { - execSync('python3.13 --version', { stdio: 'ignore' }); - } catch { - console.log('Installing Python 3.13...'); - execSync( - ` - wget -q https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tgz && - tar xzf Python-3.13.0.tgz && - cd Python-3.13.0 && - ./configure --enable-optimizations --quiet && - make -j$(nproc) --quiet && - sudo make altinstall --quiet && - cd .. && - rm -rf Python-3.13.0* - `, - { stdio: 'inherit' }, - ); - } + installPython313(); }); beforeEach(async () => { diff --git a/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts b/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts index 8a1837e2616..d1bcbbddab7 100644 --- a/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts @@ -9,6 +9,7 @@ import { functionCloudInvoke, getProjectConfig, initJSProjectWithProfile, + installPython313, LayerOptions, LayerRuntime, loadFunctionTestFile, @@ -18,7 +19,6 @@ import { overrideLayerCodePython, } from '@aws-amplify/amplify-e2e-core'; import { v4 as uuid } from 'uuid'; -import { execSync } from 'child_process'; describe('add function with layers for runtime nodeJS', () => { let projRoot: string; @@ -28,28 +28,6 @@ describe('add function with layers for runtime nodeJS', () => { let functionName: string; const runtimes: LayerRuntime[] = ['nodejs']; - // Install Python 3.13 if not available - beforeAll(async () => { - try { - execSync('python3.13 --version', { stdio: 'ignore' }); - } catch { - console.log('Installing Python 3.13...'); - execSync( - ` - wget -q https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tgz && - tar xzf Python-3.13.0.tgz && - cd Python-3.13.0 && - ./configure --enable-optimizations --quiet && - make -j$(nproc) --quiet && - sudo make altinstall --quiet && - cd .. && - rm -rf Python-3.13.0* - `, - { stdio: 'inherit' }, - ); - } - }); - beforeEach(async () => { projRoot = await createNewProjectDir('functions'); await initJSProjectWithProfile(projRoot, {}); @@ -163,6 +141,11 @@ describe('add function with layers for runtime python', () => { const [shortId] = uuid().split('-'); let functionName: string; + // Install Python 3.13 if not available + beforeAll(async () => { + installPython313(); + }); + beforeEach(async () => { projRoot = await createNewProjectDir('functions'); await initJSProjectWithProfile(projRoot, {}); diff --git a/packages/amplify-e2e-tests/src/__tests__/layer-2.test.ts b/packages/amplify-e2e-tests/src/__tests__/layer-2.test.ts index 010d15e520c..95672046641 100644 --- a/packages/amplify-e2e-tests/src/__tests__/layer-2.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/layer-2.test.ts @@ -22,6 +22,7 @@ import { getProjectConfig, getProjectMeta, initJSProjectWithProfile, + installPython313, LayerOptions, LayerPermission, LayerPermissionName, @@ -35,33 +36,14 @@ import { validatePushedVersion, } from '@aws-amplify/amplify-e2e-core'; import { v4 as uuid } from 'uuid'; -import { execSync } from 'child_process'; describe('amplify add lambda layer with changes', () => { let projRoot: string; let projName: string; const envName = 'integtest'; - // Install Python 3.13 if not available beforeAll(async () => { - try { - execSync('python3.13 --version', { stdio: 'ignore' }); - } catch { - console.log('Installing Python 3.13...'); - execSync( - ` - wget -q https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tgz && - tar xzf Python-3.13.0.tgz && - cd Python-3.13.0 && - ./configure --enable-optimizations --quiet && - make -j$(nproc) --quiet && - sudo make altinstall --quiet && - cd .. && - rm -rf Python-3.13.0* - `, - { stdio: 'inherit' }, - ); - } + installPython313(); }); beforeEach(async () => { From 235d73e4d4113e94b66d9814f779d37471aec3f1 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Mon, 29 Sep 2025 17:18:52 -0400 Subject: [PATCH 15/20] chore: some final debugging --- .../amplify-e2e-tests/src/__tests__/function_3a_python.test.ts | 1 - packages/amplify-e2e-tests/src/__tests__/function_4.test.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts b/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts index 43b5eb480c7..cf67dfe8b5c 100644 --- a/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts @@ -28,7 +28,6 @@ describe('python function tests', () => { let projRoot: string; let funcName: string; - // Install Python 3.13 if not available beforeAll(async () => { installPython313(); }); diff --git a/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts b/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts index d1bcbbddab7..670552b0868 100644 --- a/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts @@ -141,7 +141,6 @@ describe('add function with layers for runtime python', () => { const [shortId] = uuid().split('-'); let functionName: string; - // Install Python 3.13 if not available beforeAll(async () => { installPython313(); }); @@ -197,6 +196,7 @@ describe('add function with layers for runtime python', () => { const payload = '{}'; const response = await functionCloudInvoke(projRoot, { funcName: functionName, payload }); + console.log(response); expect(JSON.parse(response.Payload.toString()).body).toMatch(helloWorldSuccessOutput); }); }); From 179577c4930ffce4f9af03b277ffbc8a7d7cf854 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Mon, 29 Sep 2025 18:23:09 -0400 Subject: [PATCH 16/20] fix: pipfile --- packages/amplify-e2e-tests/functions/titlecase.pipfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify-e2e-tests/functions/titlecase.pipfile b/packages/amplify-e2e-tests/functions/titlecase.pipfile index 378ae445d57..73e2f8df307 100644 --- a/packages/amplify-e2e-tests/functions/titlecase.pipfile +++ b/packages/amplify-e2e-tests/functions/titlecase.pipfile @@ -6,7 +6,7 @@ verify_ssl = true [dev-packages] [packages] -titlecase = "==0.12.0" +titlecase = ">=2.0.0" [requires] python_version = "3.13" From 112910e97d338d372e4916fcfba3426d2435db84 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Mon, 29 Sep 2025 19:21:54 -0400 Subject: [PATCH 17/20] fix: file structure --- packages/amplify-e2e-core/src/utils/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify-e2e-core/src/utils/index.ts b/packages/amplify-e2e-core/src/utils/index.ts index 322804417cd..33951af8b24 100644 --- a/packages/amplify-e2e-core/src/utils/index.ts +++ b/packages/amplify-e2e-core/src/utils/index.ts @@ -156,7 +156,7 @@ export const overrideLayerCodePython = ( content: string, targetFileName = 'index.py', ): void => { - const dirPath = path.join(getPathToLayer(root, { projName: projectName, layerName }), 'lib', 'python'); + const dirPath = path.join(getPathToLayer(root, { projName: projectName, layerName }), 'lib', 'python3.13', 'site-packages'); const targetPath = path.join(dirPath, targetFileName); fs.ensureDirSync(dirPath); From d5b3b5bf0d4470b9b20d5d589e45a80a5c3cf4cb Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Mon, 29 Sep 2025 20:39:49 -0400 Subject: [PATCH 18/20] chore: debugging --- .../src/util/packageUtils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/amplify-python-function-runtime-provider/src/util/packageUtils.ts b/packages/amplify-python-function-runtime-provider/src/util/packageUtils.ts index 1b62e10a118..31208a3e12f 100644 --- a/packages/amplify-python-function-runtime-provider/src/util/packageUtils.ts +++ b/packages/amplify-python-function-runtime-provider/src/util/packageUtils.ts @@ -14,6 +14,7 @@ export async function pythonPackage(context: any, params: PackageRequest): Promi const pyBinary = getPythonBinaryName(); const pyVersion = await execWithOutputAsString(`${pyBinary} --version`); const layerPythonPath = path.join(params.srcRoot, 'lib', 'python' + majMinPyVersion(pyVersion), 'site-packages'); + console.log(layerPythonPath); const pipEnvDir = await getPipenvDir(params.srcRoot); // copy from virtualenv to layer path to maintain layer required structure fs.copySync(pipEnvDir, layerPythonPath, { overwrite: true }); From a9166a0bfa1f50017d101935603a15312632db69 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Mon, 29 Sep 2025 21:41:41 -0400 Subject: [PATCH 19/20] fix: another attempt --- packages/amplify-e2e-core/src/utils/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/amplify-e2e-core/src/utils/index.ts b/packages/amplify-e2e-core/src/utils/index.ts index 33951af8b24..4d91f97a383 100644 --- a/packages/amplify-e2e-core/src/utils/index.ts +++ b/packages/amplify-e2e-core/src/utils/index.ts @@ -156,7 +156,13 @@ export const overrideLayerCodePython = ( content: string, targetFileName = 'index.py', ): void => { - const dirPath = path.join(getPathToLayer(root, { projName: projectName, layerName }), 'lib', 'python3.13', 'site-packages'); + // Extract Python version from Pipfile content + const pythonVersionMatch = content.match(/python_version\s*=\s*"(\d+\.\d+)"/); + const pythonVersion = pythonVersionMatch ? pythonVersionMatch[1] : '3.8'; // fallback to 3.8 + console.log(pythonVersion); + + const dirPath = path.join(getPathToLayer(root, { projName: projectName, layerName }), 'lib', `python${pythonVersion}`, 'site-packages'); + console.log(dirPath); const targetPath = path.join(dirPath, targetFileName); fs.ensureDirSync(dirPath); From e6c5431c88133f83a3cfaaeed433b942f1be6e43 Mon Sep 17 00:00:00 2001 From: aws-amplify-bot Date: Tue, 30 Sep 2025 09:27:05 -0400 Subject: [PATCH 20/20] fix: revert to 3.8 --- packages/amplify-e2e-core/src/utils/index.ts | 9 +-------- .../amplify-e2e-core/src/utils/install-python.ts | 12 ------------ .../amplify-e2e-tests/functions/titlecase.pipfile | 4 ++-- .../src/__tests__/function_15.test.ts | 5 ----- .../src/__tests__/function_3a_python.test.ts | 5 ----- .../src/__tests__/function_4.test.ts | 6 ------ .../amplify-e2e-tests/src/__tests__/layer-2.test.ts | 11 +++-------- .../resources/Pipfile | 2 +- .../src/index.ts | 2 +- .../src/util/packageUtils.ts | 1 - .../resources/hello-world/Pipfile | 2 +- 11 files changed, 9 insertions(+), 50 deletions(-) delete mode 100644 packages/amplify-e2e-core/src/utils/install-python.ts diff --git a/packages/amplify-e2e-core/src/utils/index.ts b/packages/amplify-e2e-core/src/utils/index.ts index 4d91f97a383..31ce287d034 100644 --- a/packages/amplify-e2e-core/src/utils/index.ts +++ b/packages/amplify-e2e-core/src/utils/index.ts @@ -30,7 +30,6 @@ export * from './hooks'; export * from './git-operations'; export * from './help'; export * from './credentials-rotator'; -export * from './install-python'; /** * Whether the current environment is CircleCI or not @@ -156,13 +155,7 @@ export const overrideLayerCodePython = ( content: string, targetFileName = 'index.py', ): void => { - // Extract Python version from Pipfile content - const pythonVersionMatch = content.match(/python_version\s*=\s*"(\d+\.\d+)"/); - const pythonVersion = pythonVersionMatch ? pythonVersionMatch[1] : '3.8'; // fallback to 3.8 - console.log(pythonVersion); - - const dirPath = path.join(getPathToLayer(root, { projName: projectName, layerName }), 'lib', `python${pythonVersion}`, 'site-packages'); - console.log(dirPath); + const dirPath = path.join(getPathToLayer(root, { projName: projectName, layerName }), 'lib', 'python'); const targetPath = path.join(dirPath, targetFileName); fs.ensureDirSync(dirPath); diff --git a/packages/amplify-e2e-core/src/utils/install-python.ts b/packages/amplify-e2e-core/src/utils/install-python.ts deleted file mode 100644 index 0d25778c35c..00000000000 --- a/packages/amplify-e2e-core/src/utils/install-python.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { execSync } from 'child_process'; - -export const installPython313 = () => { - try { - execSync('python3.13 --version', { stdio: 'ignore' }); - } catch { - console.log('Installing Python 3.13...'); - execSync('sudo add-apt-repository ppa:deadsnakes/ppa -y && sudo apt-get update && sudo apt-get install -y python3.13', { - stdio: 'inherit', - }); - } -}; diff --git a/packages/amplify-e2e-tests/functions/titlecase.pipfile b/packages/amplify-e2e-tests/functions/titlecase.pipfile index 73e2f8df307..006096690e5 100644 --- a/packages/amplify-e2e-tests/functions/titlecase.pipfile +++ b/packages/amplify-e2e-tests/functions/titlecase.pipfile @@ -6,7 +6,7 @@ verify_ssl = true [dev-packages] [packages] -titlecase = ">=2.0.0" +titlecase = "==0.12.0" [requires] -python_version = "3.13" +python_version = "3.8" diff --git a/packages/amplify-e2e-tests/src/__tests__/function_15.test.ts b/packages/amplify-e2e-tests/src/__tests__/function_15.test.ts index ce923d39462..a49b6cd5677 100644 --- a/packages/amplify-e2e-tests/src/__tests__/function_15.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/function_15.test.ts @@ -6,7 +6,6 @@ import { deleteProjectDir, generateRandomShortId, initJSProjectWithProfile, - installPython313, loadFunctionTestFile, overrideFunctionSrcNode, } from '@aws-amplify/amplify-e2e-core'; @@ -15,10 +14,6 @@ import { v4 as uuid } from 'uuid'; describe('amplify push function cases:', () => { let projRoot: string; - beforeAll(async () => { - installPython313(); - }); - beforeEach(async () => { projRoot = await createNewProjectDir('multiple-function-push'); }); diff --git a/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts b/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts index cf67dfe8b5c..4f622dd0483 100644 --- a/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/function_3a_python.test.ts @@ -5,7 +5,6 @@ import { addFunction, functionMockAssert, functionCloudInvoke, - installPython313, createNewProjectDir, deleteProjectDir, generateRandomShortId, @@ -28,10 +27,6 @@ describe('python function tests', () => { let projRoot: string; let funcName: string; - beforeAll(async () => { - installPython313(); - }); - beforeEach(async () => { projRoot = await createNewProjectDir('py-functions'); await initJSProjectWithProfile(projRoot, {}); diff --git a/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts b/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts index 670552b0868..bada470a22b 100644 --- a/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/function_4.test.ts @@ -9,7 +9,6 @@ import { functionCloudInvoke, getProjectConfig, initJSProjectWithProfile, - installPython313, LayerOptions, LayerRuntime, loadFunctionTestFile, @@ -141,10 +140,6 @@ describe('add function with layers for runtime python', () => { const [shortId] = uuid().split('-'); let functionName: string; - beforeAll(async () => { - installPython313(); - }); - beforeEach(async () => { projRoot = await createNewProjectDir('functions'); await initJSProjectWithProfile(projRoot, {}); @@ -196,7 +191,6 @@ describe('add function with layers for runtime python', () => { const payload = '{}'; const response = await functionCloudInvoke(projRoot, { funcName: functionName, payload }); - console.log(response); expect(JSON.parse(response.Payload.toString()).body).toMatch(helloWorldSuccessOutput); }); }); diff --git a/packages/amplify-e2e-tests/src/__tests__/layer-2.test.ts b/packages/amplify-e2e-tests/src/__tests__/layer-2.test.ts index 95672046641..a6007b19ebb 100644 --- a/packages/amplify-e2e-tests/src/__tests__/layer-2.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/layer-2.test.ts @@ -22,7 +22,6 @@ import { getProjectConfig, getProjectMeta, initJSProjectWithProfile, - installPython313, LayerOptions, LayerPermission, LayerPermissionName, @@ -42,10 +41,6 @@ describe('amplify add lambda layer with changes', () => { let projName: string; const envName = 'integtest'; - beforeAll(async () => { - installPython313(); - }); - beforeEach(async () => { projRoot = await createNewProjectDir('layers'); await initJSProjectWithProfile(projRoot, { envName }); @@ -376,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 () => { @@ -410,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, diff --git a/packages/amplify-python-function-runtime-provider/resources/Pipfile b/packages/amplify-python-function-runtime-provider/resources/Pipfile index 4f819af807e..b5846df18ca 100644 --- a/packages/amplify-python-function-runtime-provider/resources/Pipfile +++ b/packages/amplify-python-function-runtime-provider/resources/Pipfile @@ -8,4 +8,4 @@ verify_ssl = true [packages] [requires] -python_version = "3.13" +python_version = "3.8" diff --git a/packages/amplify-python-function-runtime-provider/src/index.ts b/packages/amplify-python-function-runtime-provider/src/index.ts index 39aa43cb384..1dcab233868 100644 --- a/packages/amplify-python-function-runtime-provider/src/index.ts +++ b/packages/amplify-python-function-runtime-provider/src/index.ts @@ -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: [ diff --git a/packages/amplify-python-function-runtime-provider/src/util/packageUtils.ts b/packages/amplify-python-function-runtime-provider/src/util/packageUtils.ts index 31208a3e12f..1b62e10a118 100644 --- a/packages/amplify-python-function-runtime-provider/src/util/packageUtils.ts +++ b/packages/amplify-python-function-runtime-provider/src/util/packageUtils.ts @@ -14,7 +14,6 @@ export async function pythonPackage(context: any, params: PackageRequest): Promi const pyBinary = getPythonBinaryName(); const pyVersion = await execWithOutputAsString(`${pyBinary} --version`); const layerPythonPath = path.join(params.srcRoot, 'lib', 'python' + majMinPyVersion(pyVersion), 'site-packages'); - console.log(layerPythonPath); const pipEnvDir = await getPipenvDir(params.srcRoot); // copy from virtualenv to layer path to maintain layer required structure fs.copySync(pipEnvDir, layerPythonPath, { overwrite: true }); diff --git a/packages/amplify-python-function-template-provider/resources/hello-world/Pipfile b/packages/amplify-python-function-template-provider/resources/hello-world/Pipfile index ee8e3838b95..88b01f8a1d1 100644 --- a/packages/amplify-python-function-template-provider/resources/hello-world/Pipfile +++ b/packages/amplify-python-function-template-provider/resources/hello-world/Pipfile @@ -9,4 +9,4 @@ verify_ssl = true src = {editable = true, path = "./src"} [requires] -python_version = "3.13" +python_version = "3.8"