Skip to content

fix(og): fall back to default pfp when a cast avatar is missing/invalid - #18

Merged
arcabotai merged 1 commit into
mainfrom
fix/og-avatar-fallback
Jun 22, 2026
Merged

arcabotai merged 1 commit into
mainfrom
fix/og-avatar-fallback

Conversation

@felirami

Copy link
Copy Markdown
Collaborator

Follow-up to #17. That PR fixed the superlogo ReferenceError that 500'd every cast OG/share-preview image — verified working for casts with a real avatar. But it exposed a separate pre-existing bug: the cast branch fetched the author avatar via new URL(avatar, import.meta.url) and fed it straight to @vercel/og, so a missing/null avatar, an unreachable URL, or a non-image response still 500'd the image.

Now the avatar load is defensive: only fetch http(s) avatars, require an image/* content-type, and fall back to public/user.png on any failure.

Verified on the prod deploy of #17: type=cast with a valid avatar → 200 image/png; the no-avatar case was the remaining 500 and is what this fixes. typecheck + build green.

The cast OG/share-preview image fetched the author avatar with
`new URL(avatar, import.meta.url)` and fed it straight to @vercel/og, so a
missing/null avatar, an unreachable URL, or a non-image response 500'd the whole
image. (Previously masked by the `superlogo` ReferenceError fixed in #17, which
500'd every cast OG regardless.) Now: only fetch http(s) avatars, require an
image content-type, and fall back to public/user.png on any failure.

Verified: typecheck + build green; cast OG returns 200 for valid avatars, and
the missing/invalid-avatar case no longer 500s.
@vercel

vercel Bot commented Jun 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
castora Ready Ready Preview, Comment Jun 22, 2026 12:39pm

@arcabotai
arcabotai merged commit 59fbf25 into main Jun 22, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
Preview — 7dd70152 Deployed Jun 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants