Skip to content

fix(web): guard app-detail image src to prevent server-side crash (#7237) - #7730

Merged
kodjima33 merged 1 commit into
mainfrom
watchdog/issue-7237-app-detail-image-crash
Jun 9, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
watchdog/issue-7237-app-detail-image-crash

Conversation

@kodjima33

Copy link
Copy Markdown
Collaborator

Bug

Opening any app detail page (https://h.omi.me/apps/<id>) can show:

Application error: a server-side exception has occurred (see the server logs for more information). Digest: 1334210280

Reported in #7237.

Root cause

web/app/src/app/(public)/apps/[id]/page.tsx rendered the hero image as:

<Image src={plugin.image} ... />

with no fallback. When an app's image is empty/falsy, next/image throws during server render (src is 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/...'
  • this same file's generateMetadata → plugin.image || '/og-apps.png'

Fix

Add the same guard to the visible hero image, falling back to the local /logo.png asset (which exists in web/app/public/, unlike /og-apps.png) so the fallback itself can never 404/throw:

<Image src={plugin.image || '/logo.png'} ... />

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/image src, 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.

)

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-apps

greptile-apps Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a deterministic server-side crash on app detail pages (/apps/<id>) caused by passing an empty/null plugin.image directly to next/image, which requires a non-empty src. The one-line behavioral change adds || '/logo.png' as a fallback, consistent with every other image-rendering site in the codebase.

  • Crash fix: src={plugin.image || '/logo.png'} guards the hero <Image> against empty image fields; /logo.png is confirmed to exist in public/.
  • Remaining gap: SoftwareAppJsonLd on line 129 still receives the raw plugin.image without a fallback, which can emit an empty "image" field in JSON-LD structured data for apps with no logo — not a crash, but invalid structured data for search crawlers.
  • Other changes: Import formatting, paragraph whitespace, and JSX inline-prop reformatting — no behavioral effect.

Confidence Score: 4/5

Safe 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: /logo.png exists in public/, local static paths need no remotePatterns entry, and the || '/logo.png' idiom mirrors every other guarded image in the app. The only open item is SoftwareAppJsonLd still receiving a potentially empty image prop, which produces malformed JSON-LD structured data for imageless apps but causes no runtime crash.

The SoftwareAppJsonLd call on line 129 of page.tsx warrants a quick look — it passes plugin.image without a fallback, so apps with no image will have an empty "image" field in their schema.org structured data.

Important Files Changed

Filename Overview
web/app/src/app/(public)/apps/[id]/page.tsx Adds `

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]
Loading

Comments Outside Diff (1)

  1. web/app/src/app/(public)/apps/[id]/page.tsx, line 126-130 (link)

    P2 The SoftwareAppJsonLd component receives plugin.image directly without a fallback, so apps with no image will emit an empty string (or null/undefined) in the JSON-LD "image" field. While this doesn't cause a server crash the way the unguarded next/image did, it produces invalid structured data — search crawlers may reject or warn on a blank image property. Applying the same fallback used elsewhere in this file keeps the JSON-LD well-formed.

Reviews (1): Last reviewed commit: "fix(web): guard app-detail image src to ..." | Re-trigger Greptile

@kodjima33
kodjima33 merged commit 039f546 into main Jun 9, 2026
3 checks passed
@kodjima33
kodjima33 deleted the watchdog/issue-7237-app-detail-image-crash branch June 9, 2026 18:27
kodjima33 added a commit that referenced this pull request Jul 9, 2026
…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]>
@undivisible undivisible added the AI label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants