From 64913c1f7011d9e4885606f7b5e4c70a1c1a9716 Mon Sep 17 00:00:00 2001 From: Galib Sarayev Date: Thu, 9 Jul 2026 15:38:05 +0000 Subject: [PATCH] fix(amplify-e2e-tests): handle InvalidClientTokenId in getAmplifyApps opt-in region cleanup Opt-in regions (ap-east-1/eu-south-1) are not enabled on test accounts, causing getAmplifyApps to throw InvalidClientTokenId which propagates to process.exit(1) and fails the cleanup_e2e_resources shard. Mirror the existing getStacks() guard by also skipping on InvalidClientTokenId. Backport of the fix already on main (#3304) to release-api-plugin-stable. e2e-cleanup only, not customer-facing. --- packages/amplify-e2e-tests/src/cleanup-e2e-resources.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify-e2e-tests/src/cleanup-e2e-resources.ts b/packages/amplify-e2e-tests/src/cleanup-e2e-resources.ts index 70635cfb22..8a30fa90ab 100644 --- a/packages/amplify-e2e-tests/src/cleanup-e2e-resources.ts +++ b/packages/amplify-e2e-tests/src/cleanup-e2e-resources.ts @@ -180,7 +180,7 @@ const getAmplifyApps = async (account: AWSAccountInfo, region: string): Promise< try { amplifyApps = await amplifyClient.send(new ListAppsCommand({ maxResults: 50 })); // keeping it to 50 as max supported is 50 } catch (e) { - if (e?.name === 'UnrecognizedClientException') { + if (e?.name === 'UnrecognizedClientException' || e?.name === 'InvalidClientTokenId') { // Do not fail the cleanup and continue console.log(`Listing apps for account ${account.accountId}-${region} failed with error with code ${e?.name}. Skipping.`); return result;