Skip to content

[Low] R2 errors swallowed without logging — outages invisible in server logs #102

@bmersereau

Description

@bmersereau

Problem

backend/src/lib/storage.ts — both downloadFile and getSignedUrl silently swallow all errors:

export async function downloadFile(key: string): Promise<ArrayBuffer | null> {
  ...
  try { ... }
  catch { return null; }  // no logging
}

export async function getSignedUrl(...): Promise<string | null> {
  ...
  try { ... }
  catch { return null; }  // no logging
}

When R2 is misconfigured or unreachable, callers receive null and return 404/503 to the client. There is no server-side log entry, making R2 outages completely invisible until users report them.

Fix

Add console.error("[storage] downloadFile failed", { key, error: err }) (and equivalent for getSignedUrl) in the catch blocks before returning null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions