Repository navigation
fix(web): guard app-detail image src to prevent server-side crash (#7237) - #7730
Conversation
) The public app-detail page rendered <Image src={plugin.image}> with no fallback. When an app has an empty/falsy image, next/image throws during render, surfacing as the reported 'Application error: a server-side exception has occurred' on /apps/[id]. Every other plugin-card usage already guards plugin.image with a fallback, and this same file's generateMetadata uses a fallback too. Apply the same guard to the visible hero image, using the local /logo.png asset (which exists in public/) so the fallback itself can never fail. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Greptile SummaryThis PR fixes a deterministic server-side crash on app detail pages (
Confidence Score: 4/5Safe to merge — the one-line change correctly prevents the server crash and matches the established fallback pattern used throughout the codebase. The fix is targeted and low-risk: The Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Request: /apps/id] --> B[findAppById]
B --> C{plugin found?}
C -- No --> D[notFound - 404]
C -- Yes --> E{plugin.image truthy?}
E -- Yes --> F[Render hero Image with plugin.image]
E -- No --> G["Render hero Image with '/logo.png' fallback ✅ FIXED"]
E -- No --> H["SoftwareAppJsonLd receives empty image ⚠️ still unguarded"]
F --> I[Page renders successfully]
G --> I
H --> J[JSON-LD emits empty image field]
|
…7237) (#9185) The public app-detail page at h.omi.me (served by the web/frontend Cloud Run service) renders <Image src={plugin.image}> and Array.from(plugin. capabilities) with no fallback. When an app has an empty image or missing capabilities, next/image throws on a falsy src and Array.from(undefined) throws 'undefined is not iterable' during SSR — surfacing as the reported 'Application error: a server-side exception has occurred' on /apps/[id]. PR #7730 fixed this same bug but only in web/app; the page actually serving h.omi.me is web/frontend, which was still unguarded. Mirror the accepted guard here: fall back to the local /logo.webp asset (exists in web/frontend/public) for the image, and to [] for capabilities. Sibling plugin-card components and getAppsByCategory already guard both fields. Verified: reproduced Array.from(undefined) -> 'undefined is not iterable'; Array.from(undefined ?? []) returns []; image fallback yields a non-empty src while preserving real image URLs. Type-safe under strict: string || string -> string, string[] ?? [] -> string[]. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Bug
Opening any app detail page (
https://h.omi.me/apps/<id>) can show:Reported in #7237.
Root cause
web/app/src/app/(public)/apps/[id]/page.tsxrendered the hero image as:with no fallback. When an app's
imageis empty/falsy,next/imagethrows during server render (srcis required / cannot be empty), which surfaces as the opaque "server-side exception" digest above. Many catalog apps have no logo set, so their detail pages crash deterministically.This is inconsistent with the rest of the codebase, which always guards the image:
CompactPluginCard.tsx,FeaturedPluginCard.tsx,plugin-card/index.tsx→plugin.image || 'https://via.placeholder.com/...'generateMetadata→plugin.image || '/og-apps.png'Fix
Add the same guard to the visible hero image, falling back to the local
/logo.pngasset (which exists inweb/app/public/, unlike/og-apps.png) so the fallback itself can never 404/throw:One-line behavioral change; no API or data-shape changes.
Verification
UNVERIFIED end-to-end (no full Next.js prod build run here). Reasoned from the code: the crash path is the unguarded
next/imagesrc, and the fix mirrors the established fallback pattern used everywhere else in this app. Low risk.🤖 automated by hourly watchdog; opened for review, not merged.