From bb9fd65dbbb31bb879e93899b091587334a87278 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Thu, 12 Mar 2026 13:17:18 +0100 Subject: [PATCH] fix(og): convert font buffers to ArrayBuffer for Satori compatibility --- lib/og-helper.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/og-helper.tsx b/lib/og-helper.tsx index 27101c5b..4f36be5e 100644 --- a/lib/og-helper.tsx +++ b/lib/og-helper.tsx @@ -11,10 +11,21 @@ export async function getOgFonts() { try { console.log(`[OG] Loading fonts: bold=${boldFontPath}, regular=${regularFontPath}`); - const boldFont = readFileSync(boldFontPath); - const regularFont = readFileSync(regularFontPath); + const boldFontBuffer = readFileSync(boldFontPath); + const regularFontBuffer = readFileSync(regularFontPath); + + // Satori (Vercel OG) strictly requires an ArrayBuffer, not a Node Buffer view. + const boldFont = boldFontBuffer.buffer.slice( + boldFontBuffer.byteOffset, + boldFontBuffer.byteOffset + boldFontBuffer.byteLength, + ); + const regularFont = regularFontBuffer.buffer.slice( + regularFontBuffer.byteOffset, + regularFontBuffer.byteOffset + regularFontBuffer.byteLength, + ); + console.log( - `[OG] Fonts loaded successfully (${boldFont.length} and ${regularFont.length} bytes)`, + `[OG] Fonts loaded successfully (${boldFont.byteLength} and ${regularFont.byteLength} bytes)`, ); return [