-
Notifications
You must be signed in to change notification settings - Fork 433
OG image with netlify function #1700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughThis PR introduces an Open Graph image generation feature using Netlify Edge Functions. Changes include VSCode configuration updates to enable Deno tooling, registration of a new edge function in Netlify config, a Deno configuration file for the edge functions directory, and a new edge function that generates OG images from query parameters. Changes
Sequence DiagramsequenceDiagram
participant Client
participant EdgeFunction as Edge Function: /og
participant ImageResponse
Client->>EdgeFunction: GET /og?title=...&description=...
EdgeFunction->>EdgeFunction: Extract title & description<br/>from query params
EdgeFunction->>ImageResponse: Render styled image with<br/>title, description, watermark
ImageResponse->>EdgeFunction: Return generated image
EdgeFunction->>Client: 200 OK<br/>(image/png)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (1)
apps/web/netlify/edge-functions/og.tsx (1)
9-71: Consider adding error handling for ImageResponse.The edge function lacks error handling if
ImageResponseconstruction fails. While rare, runtime errors in production edge functions should be caught and handled gracefully.Consider wrapping in try-catch:
export default function handler(req: Request): Response { try { const url = new URL(req.url); const title = url.searchParams.get("title") || "Hyprnote"; const description = url.searchParams.get("description") || "AI Meeting Notes"; return new ImageResponse( // ... JSX ... ); } catch (error) { console.error("OG image generation failed:", error); return new Response("Internal Server Error", { status: 500 }); } }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.vscode/settings.json(2 hunks)apps/web/netlify.toml(1 hunks)apps/web/netlify/edge-functions/deno.json(1 hunks)apps/web/netlify/edge-functions/og.tsx(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: fmt
🔇 Additional comments (3)
apps/web/netlify.toml (1)
9-11: LGTM! Edge function registration is correct.The edge function configuration properly registers the OG image handler at
/og, which matches the path exported in the edge function's config object..vscode/settings.json (1)
27-31: LGTM! Deno tooling properly configured.The Deno settings are correctly scoped to the edge functions directory, enabling appropriate linting and language support for the new edge function development.
apps/web/netlify/edge-functions/og.tsx (1)
1-2: I need more specific information about the og_edge package. Let me search for the current version details:No version update needed; og_edge@0.0.6 is currently the latest stable.
The og_edge package is at version 0.0.6, marked as the latest release, and no newer versions exist. While this is a pre-1.0 release, it remains the current stable version for Netlify Edge Functions OG image generation. The library appears inactive (last release 2 years ago), but this is the recommended version to use.
No description provided.