Skip to content

Commit ef73fef

Browse files
committed
applied fix
1 parent 322224c commit ef73fef

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

opengraph-image-runtimes/src/app/opengraph-image.tsx

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Based on: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/opengraph-image#generate-images-using-code-js-ts-tsx
22

33
import { ImageResponse } from "next/og";
4-
import { readFile } from "node:fs/promises";
5-
import { join } from "node:path";
64

75
// Image metadata
86
export const alt = "About Acme";
@@ -13,16 +11,13 @@ export const size = {
1311

1412
export const contentType = "image/png";
1513

16-
export const runtime = "nodejs"; // Explicitly set
17-
18-
// Font loading, process.cwd() is Next.js project directory
19-
const geistSemiBold = readFile(
20-
join(process.cwd(), "src/assets/Geist-SemiBold.ttf")
21-
);
14+
export const runtime = "edge"; // Explicitly set
2215

2316
// Image generation
2417
export default async function Image() {
25-
const geistSemiBoldData = await geistSemiBold;
18+
const geistSemiBoldData = await fetch(
19+
new URL("../assets/Geist-SemiBold.ttf", import.meta.url)
20+
).then((r) => r.arrayBuffer());
2621

2722
return new ImageResponse(
2823
(

0 commit comments

Comments
 (0)