linshenkx/prompt-optimizer · error · Error

S3 endpoint, bucket, access key, and secret key are required

Error message

S3 endpoint, bucket, access key, and secret key are required

What it means

assertConfigured() runs before S3 operations and requires endpoint, bucket, accessKeyId and secretAccessKey all set. Missing any one throws this configuration error before any network call.

Source

Thrown at packages/ui/src/utils/remote-backup.ts:1705

    return joinRemotePath(this.prefix(), path)
  }

  private listPrefixForPath(path: string): string {
    return `${this.keyForPath(path)}/`
  }

  private pathFromKey(key: string): string {
    const prefix = this.prefix()
    return key === prefix
      ? ''
      : key.startsWith(`${prefix}/`)
        ? key.slice(prefix.length + 1)
        : key
  }

  private assertConfigured(): void {
    if (!this.config.endpoint || !this.config.bucket || !this.config.accessKeyId || !this.config.secretAccessKey) {
      throw new Error('S3 endpoint, bucket, access key, and secret key are required')
    }
  }
}

class CloudflareR2RemoteObjectStore extends S3CompatibleRemoteObjectStore {
  provider: RemoteBackupProviderKind = 'cloudflare-r2'

  constructor(config: Extract<RemoteBackupProviderConfig, { kind: 'cloudflare-r2' }>) {
    super(toCloudflareR2S3Config(config))
  }
}

export const createRemoteObjectStore = (
  provider: RemoteBackupProviderConfig,
  runtime: RemoteBackupRuntime = 'web',
): RemoteObjectStore => {
  if (runtime === 'desktop') {
    if (provider.kind === 'google-drive') {

View on GitHub (pinned to 3e677b1d9f)

Solutions

  1. Fill all four required fields in the S3/R2 provider settings (endpoint URL, bucket, access key id, secret access key)
  2. Validate the config form before save: all four fields non-empty
  3. Re-enter secrets after importing a config — secrets are typically not exported

Example fix

// before
{ kind: 'cloudflare-r2', endpoint: '', bucket: 'backups', accessKeyId: '', secretAccessKey: '' }
// after
{ kind: 'cloudflare-r2', endpoint: 'https://<account>.r2.cloudflarestorage.com', bucket: 'backups', accessKeyId: 'AKI...', secretAccessKey: '...' }
Defensive patterns

Strategy: validation

Validate before calling

const { endpoint, bucket, accessKeyId, secretAccessKey } = s3Config
const isValid = [endpoint, bucket, accessKeyId, secretAccessKey].every(v => v && v.trim())

Type guard

const isS3ConfigComplete = (c: RemoteBackupProviderConfig): boolean => c.kind !== 'cloudflare-r2' && c.kind !== 's3' ? true : Boolean(c.endpoint && c.bucket && c.accessKeyId && c.secretAccessKey)

Prevention

When it happens

Trigger: Constructing/using an S3/R2 provider config where any of endpoint, bucket, accessKeyId, secretAccessKey is empty — blank settings form, partial import, or UI saving defaults.

Common situations: User filled only some S3 fields; config import dropped secret keys (intentionally excluded from exports); env-driven config missing at runtime.

Related errors


AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27). Data as JSON: /api/errors/47e2bab788506436. Report an issue: GitHub.