Skip to content

S3Credentials

Defined in: src/persistence/object-storage/S3ObjectStorageBackend.ts:41

S3-compatible ObjectStorageBackend — wraps AWS SDK v3 (@aws-sdk/client-s3) and works against AWS S3, MinIO, Cloudflare R2, Backblaze B2, DigitalOcean Spaces, Wasabi … any service that speaks the S3 API.

@aws-sdk/client-s3 is an optional peer dependency: this module lazy-imports the SDK only when put/get/delete/list is first called, so users who don’t reach for the S3 backend don’t pay the ~3-4 MB SDK weight. The same pattern is used by NodeHonoRunner for @hono/node-server.

Strict CAS maps to S3’s HTTP preconditions:

  • ifMatch: '<etag>' → HTTP If-Match: <etag> — refuse if changed
  • ifNoneMatch: '*' → HTTP If-None-Match: * — refuse if exists

Both surface as 412 Precondition Failed from S3, which we translate to ObjectStorageConcurrencyError. S3 added If-None-Match PUT support in August 2024; older S3-compatible stores may reject it — that’s a backend-version issue, not a code issue, and the resulting error is propagated as ObjectStorageBackendError.

Endpoint override — for MinIO / R2 / Backblaze: pass endpoint and (for path-style services like MinIO) forcePathStyle: true. For R2 the canonical region is 'auto'.

readonly accessKeyId: string

Defined in: src/persistence/object-storage/S3ObjectStorageBackend.ts:42


readonly secretAccessKey: string

Defined in: src/persistence/object-storage/S3ObjectStorageBackend.ts:43


readonly optional sessionToken?: string

Defined in: src/persistence/object-storage/S3ObjectStorageBackend.ts:44