Skip to content

Commit

Permalink
wip: debug next/og
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Feb 4, 2025
1 parent f57e5c7 commit 74047bf
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/react-server-next/src/compat/og.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ export class ImageResponse extends Response {
constructor(...args: ConstructorParameters<typeof OgType.ImageResponse>) {
const body = new ReadableStream({
async start(controller) {
const ogModule = await import("@vercel/og");
const response = new ogModule.ImageResponse(...args);
tinyassert(response.body);
for await (const chunk of response.body) {
controller.enqueue(chunk);
try {
const ogModule = await import("@vercel/og");
const response = new ogModule.ImageResponse(...args);
tinyassert(response.body);
for await (const chunk of response.body) {
controller.enqueue(chunk);
}
controller.close();
} catch (e) {
console.error("[ERROR:ImageResponse]", e);
}
controller.close();
},
});
const headers = new Headers(args[1]?.headers);
Expand Down

0 comments on commit 74047bf

Please sign in to comment.