You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
app/api/embeds/metadata/route.ts reads Trek's parse output via result.metadata.*, but @officialunofficial/trek@0.2.1 flattens metadata onto the result root — result.metadata is undefined. So when Trek (the primary parser) returns a title, the route emits a preview with title only — no description, no image — and returns early, never reaching the Microlink/Neynar fallbacks that would have supplied them.
Repro (verified against the live page)
GET /api/embeds/metadata?url=https://jup.ag/prediction/world-cup
og:description = "Pick 5 World Cup matches. Win all 5 to share the prize pool."
Trek extracts them correctly (top level): result.image = "…world-cup-v2.webp", result.description = "…".
But the route reads result.metadata.og_image / .description → undefined, so the API returns { metadata: { url, title: "Jupiter" } } — no image, no description.
In-app this renders as a link card with a title but no thumbnail and no description (e.g. the jup.ag/prediction/world-cup embed).
Root cause
// route.ts (fetchWithTrek)constmetadata=result.metadata||{};// result.metadata is undefined → {}consttitle=metadata.title||metadata.og_title||result.title;// survives via result.title fallback// ...description: metadata.description||metadata.og_description,// → undefinedimage: metadata.og_image||metadata.image,// → undefined
Trek 0.2.1 returns result.title / result.description / result.image / result.favicon at the root; there is no result.metadata.
Verified empirically by running @officialunofficial/trek@0.2.1 on the live page (Node, prod-style readFileSync + initSync).
Caveat to confirm: if the .wasm doesn't actually load in the Vercel bundle, the route falls through to Microlink/Neynar and the bug is masked (but Trek would then be dead weight). Worth confirming which case is live.
Summary
app/api/embeds/metadata/route.tsreads Trek's parse output viaresult.metadata.*, but@officialunofficial/trek@0.2.1flattens metadata onto the result root —result.metadataisundefined. So when Trek (the primary parser) returns a title, the route emits a preview with title only — nodescription, noimage— and returns early, never reaching the Microlink/Neynar fallbacks that would have supplied them.Repro (verified against the live page)
GET /api/embeds/metadata?url=https://jup.ag/prediction/world-cupThe page's server HTML contains:
og:image = https://jup.ag/meta-og/jupiter-meta-prediction-world-cup-v2.webpog:description = "Pick 5 World Cup matches. Win all 5 to share the prize pool."Trek extracts them correctly (top level):
result.image = "…world-cup-v2.webp",result.description = "…".But the route reads
result.metadata.og_image/.description→undefined, so the API returns{ metadata: { url, title: "Jupiter" } }— no image, no description.In-app this renders as a link card with a title but no thumbnail and no description (e.g. the
jup.ag/prediction/world-cupembed).Root cause
Trek 0.2.1 returns
result.title/result.description/result.image/result.faviconat the root; there is noresult.metadata.Fix
Read the top-level fields:
Impact
Every link preview where Trek finds a title (the common case) shows title only — most visibly, no preview image.
Notes
@officialunofficial/trek@0.2.1on the live page (Node, prod-stylereadFileSync+initSync)..wasmdoesn't actually load in the Vercel bundle, the route falls through to Microlink/Neynar and the bug is masked (but Trek would then be dead weight). Worth confirming which case is live.