Sonarly Claude Code da775d437e fix: add retry with credential refresh for S3 ExpiredToken errors
https://sonarly.com/issue/19873?type=bug

Workflow code actions fail when the S3 client's cached AWS temporary credentials expire, preventing the worker from reading built logic function code from S3.

Fix: Added retry-on-credential-error logic to `S3Driver.readFile()` in `s3.driver.ts`.

**What changed:**

1. **`s3.driver.ts`**: Added a constant `RETRYABLE_CREDENTIAL_ERROR_NAMES` listing AWS error names (`ExpiredToken`, `ExpiredTokenException`, `RequestExpired`) that indicate stale temporary credentials. Added a private `isRetryableCredentialError()` helper. In `readFile()`, when the initial S3 GetObject fails with one of these errors, the driver now logs a warning and retries once with a fresh command. The retry naturally causes the AWS SDK's `fromNodeProviderChain` credential provider to refresh the expired credentials.

2. **`s3.driver.spec.ts`**: Added three test cases for the new behavior:
   - Retry succeeds on `ExpiredToken` (verifies `send` is called twice)
   - `NoSuchKey` errors are not retried (still thrown as `FileStorageException`)
   - Non-retryable errors (e.g., `AccessDenied`) propagate immediately

The fix is minimal and surgical — only the `readFile` method (the affected code path from the stack trace) is modified. The retry is limited to exactly one attempt to avoid infinite loops. If the credential refresh itself fails, the error propagates naturally.
2026-03-31 07:40:20 +00:00
2026-03-11 16:30:28 +01:00

Twenty logo

The #1 Open-Source CRM

🌐 Website · 📚 Documentation · Roadmap · Discord · Figma


Cover


Installation

See: 🚀 Self-hosting 🖥️ Local Setup

Why Twenty

We built Twenty for three reasons:

CRMs are too expensive, and users are trapped. Companies use locked-in customer data to hike prices. It shouldn't be that way.

A fresh start is required to build a better experience. We can learn from past mistakes and craft a cohesive experience inspired by new UX patterns from tools like Notion, Airtable or Linear.

We believe in open-source and community. Hundreds of developers are already building Twenty together. Once we have plugin capabilities, a whole ecosystem will grow around it.


What You Can Do With Twenty

Please feel free to flag any specific needs you have by creating an issue.

Below are a few features we have implemented to date:

Personalize layouts with filters, sort, group by, kanban and table views

Companies Kanban Views

Customize your objects and fields

Setting Custom Objects

Create and manage permissions with custom roles

Permissions

Automate workflow with triggers and actions

Workflows

Emails, calendar events, files, and more

Other Features


Stack

Thanks

Chromatic Greptile Sentry Crowdin E2B

Thanks to these amazing services that we use and recommend for UI testing (Chromatic), code review (Greptile), catching bugs (Sentry) and translating (Crowdin).

Join the Community

Languages
TypeScript 78%
MDX 18.5%
JavaScript 3.1%
Python 0.2%