From ba1aaedd1934b9e17e033e544a4fa3e079419b92 Mon Sep 17 00:00:00 2001 From: David Snelling Date: Wed, 30 Jul 2025 15:47:26 -0700 Subject: [PATCH] **fix(storage): handle additional errors in S3-compatible storage adapter** - Updated error handling in `S3CompatibleStorage` to include checks for `NotFound` errors alongside `NoSuchKey` during lock operations. - Ensured robustness in determining lock existence and managing exceptions related to missing keys. **Purpose**: Improve resilience of the S3-compatible storage adapter by addressing additional error scenarios, ensuring accurate lock detection and stable operation. --- src/storage/adapters/s3CompatibleStorage.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/storage/adapters/s3CompatibleStorage.ts b/src/storage/adapters/s3CompatibleStorage.ts index e7bc9e9f..1b674b42 100644 --- a/src/storage/adapters/s3CompatibleStorage.ts +++ b/src/storage/adapters/s3CompatibleStorage.ts @@ -1757,8 +1757,11 @@ export class S3CompatibleStorage extends BaseStorage { return false } } catch (error: any) { - // If HeadObject fails with NoSuchKey, the lock doesn't exist, which is good - if (error.name !== 'NoSuchKey' && !error.message?.includes('NoSuchKey')) { + // If HeadObject fails with NoSuchKey or NotFound, the lock doesn't exist, which is good + if (error.name !== 'NoSuchKey' && + !error.message?.includes('NoSuchKey') && + error.name !== 'NotFound' && + !error.message?.includes('NotFound')) { throw error } } @@ -1826,7 +1829,10 @@ export class S3CompatibleStorage extends BaseStorage { } } catch (error: any) { // If lock doesn't exist, that's fine - if (error.name === 'NoSuchKey' || error.message?.includes('NoSuchKey')) { + if (error.name === 'NoSuchKey' || + error.message?.includes('NoSuchKey') || + error.name === 'NotFound' || + error.message?.includes('NotFound')) { return } throw error