Refactor host URL retrieval in Open Graph API routes for improved error handling
Build Images and Deploy / Update-PROD-Stack (push) Failing after 36s

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-05-04 01:10:18 -04:00
parent 3f542289a8
commit d51e0d6507
4 changed files with 8 additions and 4 deletions
+2 -1
View File
@@ -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(
(
+2 -1
View File
@@ -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(
(
+2 -1
View File
@@ -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(
(
+2 -1
View File
@@ -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(
(