Degrade gracefully when galleries API returns 5xx (BIT-33535) #324

Merged
bug-squasher merged 1 commits from fix/BIT-33535-galleries-500-graceful-degradation into main 2026-12-04 10:14:42 +00:00
Member

Fix

The site home page SSR fetches galleries, latest, and popular in Promise.all. When the API has a transient Postgres outage, the galleries endpoint returns 500 and the site rethrows it, tripping the Error Loop reporter.

Wrap non-critical fetches (galleries, latest, popular) with a safe() helper that returns empty data on server errors while keeping:

  • 404 → NotFound (unconfigured shop)
  • 500 from getSite() as a real error

Test

New test apps/site/src/app/page.test.ts mocks the API returning 500 for /v1/public/galleries and asserts the home page load returns empty galleries instead of throwing. Also covers 404 → null and 500 from site → throw.

Paperclip-Issue: BIT-33535

## Fix The site home page SSR fetches galleries, latest, and popular in `Promise.all`. When the API has a transient Postgres outage, the galleries endpoint returns 500 and the site rethrows it, tripping the Error Loop reporter. Wrap non-critical fetches (galleries, latest, popular) with a `safe()` helper that returns empty data on server errors while keeping: - 404 → `NotFound` (unconfigured shop) - 500 from `getSite()` as a real error ## Test New test `apps/site/src/app/page.test.ts` mocks the API returning 500 for `/v1/public/galleries` and asserts the home page load returns empty galleries instead of throwing. Also covers 404 → null and 500 from site → throw. Paperclip-Issue: BIT-33535
bug-squasher added 1 commit 2026-12-04 10:00:07 +00:00
Degrade gracefully when galleries API returns 5xx (BIT-33535)
ci / typescript (push) Skipped
ci / rust (push) Skipped
ci / rust (pull_request) Successful in 5m30s
ci / typescript (pull_request) Successful in 11m54s
932b9db233
The site home page SSR fetches galleries, latest, and popular in
Promise.all. When the API has a transient Postgres outage, the
galleries endpoint returns 500 and the site rethrows it, tripping
the Error Loop reporter. Wrap non-critical fetches (galleries,
latest, popular) with a safe() helper that returns empty data on
server errors while keeping 404 -> NotFound and 500 from getSite()
as real errors.

Paperclip-Issue: BIT-33535
bug-squasher merged commit 1e3cee8612 into main 2026-12-04 10:14:42 +00:00
Sign in to join this conversation.