From 260409902e2b8a7a59fcdd75c2487b71c4f3caea Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Thu, 9 Apr 2026 20:49:34 +0200 Subject: [PATCH] fix credentials concurrent promise bug (by devin) --- packages/@uppy/aws-s3/src/s3-client/S3mini.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/@uppy/aws-s3/src/s3-client/S3mini.ts b/packages/@uppy/aws-s3/src/s3-client/S3mini.ts index 23813e92c..a65620029 100644 --- a/packages/@uppy/aws-s3/src/s3-client/S3mini.ts +++ b/packages/@uppy/aws-s3/src/s3-client/S3mini.ts @@ -117,14 +117,16 @@ class S3mini extends S3Client { // Cache the promise so concurrent calls wait for the same fetch if (this.cachedCredentialsPromise == null) { - try { - const creds = await this.getCredentials!({}) - this.cachedCredentials = creds - return creds - } finally { - // Clear promise cache after resolution to allow future retries - this.cachedCredentialsPromise = undefined - } + this.cachedCredentialsPromise = (async () => { + try { + const creds = await this.getCredentials!({}) + this.cachedCredentials = creds + return creds + } finally { + // Clear promise cache after resolution to allow future retries + this.cachedCredentialsPromise = undefined + } + })() } return this.cachedCredentialsPromise