Skip to content

Preview OG Worker renders the neutral card for every input — og-preview can't reach web-preview /internal (likely INTERNAL_SECRET unset on preview) #148

Description

@lukaso-bot

Found while exercising the #144 preview deploy before calling it mergeable.

The preview OG Worker renders the neutral "no result" card for every input, so the one
surface OG changes actually get reviewed on cannot validate an OG change at all.

Evidence (all read-only GETs, this cycle)

request preview production
/r/honojs/hono/c/f82aba8…d176.png (real result) 200, 14348 B, 827 ms 200, 28899 B, 496 ms
/r/honojs/hono/c/0123…6789.png (nonsense SHA, no result possible) 200, 14244 B, 598 ms
/i/honojs/hono/11.png (real issue result) 200, 12915 B, 509 ms 200, 35266 B, 577 ms
/placeholder.png (the static file, for reference) 200, 11757 B 200, 11757 B

A real result and a nonsense SHA render cards within 100 bytes of each other, both in under
a second. That is the neutral card in both cases — not the static placeholder.png, and not a
lookup that ran and failed: no lookup is being attempted. Meanwhile the preview web Worker is
healthy and does do real lookups (/r/honojs/hono/c/f82aba8…d176 took 11.9 s and returned a full
27 KB page), so the break is specifically og-preview → web-preview /internal/*.

Most likely cause

INTERNAL_SECRET is not set (or does not match) on the preview Workers. preview.yml documents
it as a manual, per-environment step that the deploy does not perform:

# wrangler secret put INTERNAL_SECRET --env preview   (packages/web AND web-og, same value)

and isServiceBinding() (packages/web/src/routes/internal.ts) fails closed when the secret
is unset — a deliberate, correct choice (#141's fail-closed fix) that here produces a silent 404
on every /internal call, which web-og turns into the neutral card. I have not verified this
directly, because reading or setting a secret is outside what the loop does.

Fix (human, one time — the loop can't do this)

Run both, from the repo root. The same value must go to both Workers, and it must match what
web uses, or the handshake fails exactly as it does now:

cd packages/web    && npx wrangler secret put INTERNAL_SECRET --env preview
cd ../web-og       && npx wrangler secret put INTERNAL_SECRET --env preview

Then re-run the preview deploy on any open PR and re-check: a real commit should render ~29 KB,
a nonsense SHA ~14 KB. Order matters only in that both must be set before the next deploy is
exercised
— setting one alone leaves the handshake broken in the same way.

Why it is worth fixing rather than living with

Preview is where OG changes get reviewed, and the last three OG issues (#53, #143, #141) were all
"the unfurl silently served the wrong card". A preview that always serves the wrong card cannot
catch any of them — and worse, it looks like it is working: HTTP 200, a valid PNG, no error
anywhere. Consider also having preview.yml fail loudly if /internal returns 404 to og-preview,
so this can't silently regress again.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions