diff --git a/src/app/api/og/fund/[slug]/route.tsx b/src/app/api/og/fund/[slug]/route.tsx index e6523a4..b8be26e 100644 --- a/src/app/api/og/fund/[slug]/route.tsx +++ b/src/app/api/og/fund/[slug]/route.tsx @@ -55,7 +55,8 @@ export async function GET( style: 'currency', currency: 'USD', notation: Math.abs(n) >= 10000 ? 'compact' : 'standard', maximumFractionDigits: 2, }).format(n) - const host = new URL(process.env.NEXTAUTH_URL ?? 'http://localhost:3000').host + const rawUrl = process.env.NEXTAUTH_URL || 'http://localhost:3000' + const host = (() => { try { return new URL(rawUrl).host } catch { return rawUrl } })() return new ImageResponse( ( diff --git a/src/app/api/og/hashtag/[tag]/route.tsx b/src/app/api/og/hashtag/[tag]/route.tsx index 251e505..09c7a7e 100644 --- a/src/app/api/og/hashtag/[tag]/route.tsx +++ b/src/app/api/og/hashtag/[tag]/route.tsx @@ -65,7 +65,8 @@ export async function GET( }).format(price) const polyline = buildPolyline(prices) - const host = new URL(process.env.NEXTAUTH_URL ?? 'http://localhost:3000').host + const rawUrl = process.env.NEXTAUTH_URL || 'http://localhost:3000' + const host = (() => { try { return new URL(rawUrl).host } catch { return rawUrl } })() return new ImageResponse( ( diff --git a/src/app/api/og/leaderboard/route.tsx b/src/app/api/og/leaderboard/route.tsx index fdda123..b564b18 100644 --- a/src/app/api/og/leaderboard/route.tsx +++ b/src/app/api/og/leaderboard/route.tsx @@ -33,7 +33,8 @@ export async function GET() { }).format(n) const medals = ['🥇', '🥈', '🥉', '4.', '5.'] - const host = new URL(process.env.NEXTAUTH_URL ?? 'http://localhost:3000').host + const rawUrl = process.env.NEXTAUTH_URL || 'http://localhost:3000' + const host = (() => { try { return new URL(rawUrl).host } catch { return rawUrl } })() return new ImageResponse( ( diff --git a/src/app/api/og/profile/[username]/route.tsx b/src/app/api/og/profile/[username]/route.tsx index 7271759..ec98203 100644 --- a/src/app/api/og/profile/[username]/route.tsx +++ b/src/app/api/og/profile/[username]/route.tsx @@ -46,7 +46,8 @@ export async function GET( }).format(n) const pnlColor = unrealizedPnl >= 0 ? '#34d399' : '#f87171' - const host = new URL(process.env.NEXTAUTH_URL ?? 'http://localhost:3000').host + const rawUrl = process.env.NEXTAUTH_URL || 'http://localhost:3000' + const host = (() => { try { return new URL(rawUrl).host } catch { return rawUrl } })() return new ImageResponse( (