Skip to content

fix(web): guard app-detail image + capabilities on h.omi.me frontend (#7237) - #9185

Merged
kodjima33 merged 1 commit into
mainfrom
watchdog/issue-7237-frontend-app-detail-guard
Jul 9, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
watchdog/issue-7237-frontend-app-detail-guard

Conversation

@kodjima33

@kodjima33 kodjima33 commented Jul 7, 2026 •

Copy link
Copy Markdown
Collaborator

Bug (#7237)

App detail pages on h.omi.me crash with:

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

Repro: https://h.omi.me/apps/ → click any app → white error screen.

Root cause

web/frontend/src/app/apps/[id]/page.tsx renders two fields with no fallback:

  • Line 216 <Image src={plugin.image}> — next/image throws during SSR when src is empty/falsy.
  • Line 349 Array.from(plugin.capabilities) — Array.from(undefined) throws undefined is not iterable when an app has no capabilities.

getAppById returns raw JSON.parse(...) data with no defaults, so both fields can be missing. This file's sibling components already guard them (plugin.image || 'https://via.placeholder.com/...' in the plugin cards; Array.isArray(plugin.capabilities) in getAppsByCategory), but the detail page's hero image and capabilities list were not.

Why it wasn't already fixed: PR #7730 fixed this exact bug but only in web/app/src/app/(public)/apps/[id]/page.tsx. The page actually serving h.omi.me is the web/frontend Cloud Run service (.github/workflows/gcp_frontend.yml builds/deploys web/frontend), which was still unguarded.

Fix

Mirror the accepted #7730 guard in web/frontend:

  • src={plugin.image || '/logo.webp'} — local asset (exists in web/frontend/public/) so the fallback itself can't fail.
  • Array.from(plugin.capabilities ?? []).

Two null guards, no behavior change for valid data. Type-safe under strict (string || string → string, string[] ?? [] → string[]).

Verification

  • Reproduced the mechanism: Array.from(undefined) → undefined is not iterable; Array.from(undefined ?? []) → []. Image fallback yields a non-empty src while preserving real image URLs.
  • Diff is 2 substantive lines (+ one pre-existing ternary re-indented by the repo Prettier pre-commit hook).
  • Could not run next build locally (no node_modules in the worktree); CI runs the real frontend build + lint.

🤖 automated by hourly watchdog. This is a live prod bug (h.omi.me app-detail pages crash for any app missing an image or capabilities); opened under the prod auto-merge gate — merging deploys the frontend Cloud Run service.

Review in cubic

…7237)

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Confidence score: 4/5

  • In web/frontend/src/app/apps/[id]/page.tsx, the fallback "/logo.webp" points to a missing asset, so users who hit the fallback path will see a broken image even though the SSR crash is fixed; add the file under public/ or update the fallback to an existing asset before merging.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="web/frontend/src/app/apps/[id]/page.tsx">

<violation number="1" location="web/frontend/src/app/apps/[id]/page.tsx:216">
P2: The fallback image path `/logo.webp` references a file that doesn't exist in the `public/` directory. While this change successfully prevents the SSR crash (the original bug), the fallback itself will render as a broken 404 image when `plugin.image` is falsy. Users on the app-detail page will see a broken image icon instead of a placeholder.

Consider either:
- Adding a `logo.webp` asset to `public/`, or
- Using a known-existing placeholder such as a base64 data URI or an SVG that is already available in the project.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

<div className="relative aspect-square overflow-hidden rounded-[1rem] bg-[#1A1F2E]">
<Image
src={plugin.image}
src={plugin.image || '/logo.webp'}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The fallback image path /logo.webp references a file that doesn't exist in the public/ directory. While this change successfully prevents the SSR crash (the original bug), the fallback itself will render as a broken 404 image when plugin.image is falsy. Users on the app-detail page will see a broken image icon instead of a placeholder.

Consider either:

  • Adding a logo.webp asset to public/, or
  • Using a known-existing placeholder such as a base64 data URI or an SVG that is already available in the project.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At web/frontend/src/app/apps/[id]/page.tsx, line 216:

<comment>The fallback image path `/logo.webp` references a file that doesn't exist in the `public/` directory. While this change successfully prevents the SSR crash (the original bug), the fallback itself will render as a broken 404 image when `plugin.image` is falsy. Users on the app-detail page will see a broken image icon instead of a placeholder.

Consider either:
- Adding a `logo.webp` asset to `public/`, or
- Using a known-existing placeholder such as a base64 data URI or an SVG that is already available in the project.</comment>

<file context>
@@ -213,7 +213,7 @@ export default async function PluginDetailView(props: {
               <div className="relative aspect-square overflow-hidden rounded-[1rem] bg-[#1A1F2E]">
                 <Image
-                  src={plugin.image}
+                  src={plugin.image || '/logo.webp'}
                   alt={plugin.name}
                   className="h-full w-full object-cover transition-transform duration-300 hover:scale-105"
</file context>

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the focused fix here. The two runtime guards look like the right shape for the h.omi.me app-detail crash: using /logo.webp keeps next/image from receiving an empty/falsy src, and plugin.capabilities ?? [] avoids the Array.from(undefined) server-side exception while preserving behavior when capabilities are present.

I’m requesting changes only because the current head is still failing the repo lint/format gate. After installing the frontend dependencies and running npm run lint in web/frontend, ESLint reports prettier/prettier errors in src/app/apps/[id]/page.tsx at the re-indented nested ternary around lines 159-160. Please reformat with the repo’s local formatter/linter version (or revert that unrelated ternary indentation churn) so CI is green.

No security or agent-behavior concerns found; once the lint failure is fixed this looks like a small, low-risk bug fix.

@kodjima33
kodjima33 merged commit 5aae506 into main Jul 9, 2026
3 of 4 checks passed
@kodjima33
kodjima33 deleted the watchdog/issue-7237-frontend-app-detail-guard branch July 9, 2026 04:06
Git-on-my-level added a commit that referenced this pull request Jul 9, 2026
Pre-existing upstream formatting issue in web/frontend/src/app/apps/[id]/page.tsx
(commit 5aae506 / #9185) that blocked Frontend Lint CI. Prettier v2 (used by CI)
formats nested ternaries differently from v3 (installed locally).
@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.

3 participants