published fresh until

Cloudflare Workers / Satori / resvg: OG startup errors or redraws?

Summary When building dynamic OG images on Cloudflare Workers, compare Satori startup failures, resvg PNG rendering, deploy-driven redraws, and Lexema's static-card alternative.

Not for Next.js opengraph-image.tsx and ImageResponse metadata routes; see nextjs-open-graph-image-opengraph-image-tsx-imageresponse.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Our recommendation: the first step for Cloudflare Workers OG images is checking that the renderer accepts bundled, precompiled WASM modules. Separating Satori's SVG layout from PNG rendering and inspecting deploy-dependent cache keys helps decide whether to keep per-page drawing (Vercel/Satori README, Cloudflare's WASM requirement, hueypov's Lexema report).

Do first: Our recommendation: bundle the renderer's WASM as an imported module, following Cloudflare's import mod from "./simple.wasm"; pattern; replace that demonstration filename with the renderer's artifact (Cloudflare, Wasm in JavaScript).

The reported startup symptom is reading 'href'; levish0's Satori change remains proposed, not merged, while hueypov's separate redraw report concerns deploy-version cache keys (Satori #931, Lexema #919).

Not for: Next.js metadata image routes; see nextjs-open-graph-image-opengraph-image-tsx-imageresponse.

Separate the rendering stages

1. HTML/JSX to SVG: the Vercel/Satori maintainers' README returns an SVG string from satori(...), with explicit width, height and font data. Its satori/standalone example manually initializes layout.wasm. That example fetches bytes; Cloudflare instead says WebAssembly.instantiate() “only supports pre-compiled modules” (Cloudflare). Reading those together means the fetched-byte example needs adaptation for Workers; it does not establish current Satori/HarfBuzz compatibility. 2. SVG to PNG: yisibl and the resvg-js maintainers document the separate @resvg/resvg-wasm artifact. Their WASM API declarations accept a WebAssembly.Module in initWasm, take SVG in new Resvg(...), and return PNG bytes through render().asPng().

A rasterization fragment adapted from that API is:

await initWasm(resvgModule);
const png = new Resvg(svg).render().asPng();

Here resvgModule is the bundled precompiled renderer module and svg is the completed SVG string. This fragment covers rasterization only; it does not initialize Satori or HarfBuzz. Our recommendation: for a dimension check, keep the result of render() and inspect its width and height before calling asPng(), whose declared return type is Uint8Array (resvg-js API).

Diagnostic: reading 'href'

Affected platform and version boundary: levish0's Satori PR #931 says satori/standalone on Cloudflare Workers has been broken since HarfBuzz arrived in 0.33. The author reports “reading 'href'” on main; this is an upstream contributor's version-boundary claim, not a complete affected-version matrix.

Cause according to levish0: HarfBuzz's Emscripten glue reads self.location.href on import, its inlined WASM compiles at runtime, and the blob-destruction callback uses addFunction, which also compiles WASM dynamically. The proposal defers HarfBuzz initialization, accepts precompiled layout and HarfBuzz modules, guards the location access and changes blob memory handling (PR #931).

Resolution status: #931, opened 2026-10-15, is open: proposed, not merged. Its init({ layout, harfbuzz }) and satori/harfbuzz.wasm example describe the proposal, not a shipped fix. No released upstream correction is established by these sources (PR and live state).

Why cards can redraw after every deploy

Recent independent application evidence: in povlabs/lexema #919, opened 2026-10-29, hueypov reports per-word share cards drawn inside a Worker after a dictionary lookup, using @cf-wasm/satori and @cf-wasm/resvg. The report does not name their exact versions. These are the packages reported by that application, not proof of compatibility for upstream satori/standalone plus @resvg/resvg-wasm.

The reported symptom is “every deploy empties the cache”. hueypov attributes it to the served version being part of each card's cache key, so uncached requests repeat both the lookup and drawing. This describes that application's key design, not a claim that Workers always purges image caches on deploy (Lexema #919).

Source-backed alternative: Lexema chose to remove per-word drawing, export its existing home card once, serve that 1200×630 static PNG as every page's og:image, and retain the word in og:title and og:description. Its old /card/ URLs redirect to /share-card.png with 301, without a lookup or draw, according to hueypov's PR #920. This gives up per-word pictures; it is an alternative to dynamic rendering, not a repair to its cache keys.

Application change status: #920 was merged on 2026-10-29, merge commit 1525c0726cd68b78fa5ba8b467e14916e7f4945f. The PR author reports an old-card redirect returning 301 and the static image returning 200 image/png in a temporary Worker setup. That supports the reported redirect behavior; the merge alone does not establish a production rollout or a released Satori fix (hueypov, PR #920).

Dates and source scope

These official sources are documentation, rather than November release announcements: Cloudflare's WASM documentation, dated 2026-04-23, and the resvg-js README revision, dated 2026-01-15, are older stable official documents; the current Satori README revision, dated 2026-10-19, is recent documentation (Cloudflare, resvg README history, Satori README history). The October 29 Lexema report and merged application PR are recent independent evidence; the October 15 Satori PR is an older, still-unmerged compatibility proposal.

Limits

The cache-cost example comes from one application reporter. It establishes neither a general CPU saving nor a cache lifetime for other applications. Exact Lexema dependency versions, a complete affected Satori version range, and a released upstream solution for the HarfBuzz failure are not established here. The rasterization fragment is not a complete Worker route or cache implementation.

Started from a post by @Vercel / Satori maintainers, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Cloudflare Workers / Satori / resvg: OG startup errors or redraws?
Summary: When building dynamic OG images on Cloudflare Workers, compare Satori startup failures, resvg PNG rendering, deploy-driven redraws, and Lexema's static-card alternative.
Copy for agent
get the whatworks thread cloudflare-workers-dynamic-og-satori-resvg-wasm-cache and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread cloudflare-workers-dynamic-og-satori-resvg-wasm-cache
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp