Skip to content

[Hotfix] Vercel deploy fails: Edge Function OG route imports mint.club-v2-sdk #922

@realproject7

Description

@realproject7

Problem

ALL deployments to Vercel are failing with:

Error: The Edge Function "story/[storylineId]/og" is referencing unsupported modules:
  - mint.club-v2-sdk

The OG image route (src/app/story/[storylineId]/og/route.tsx) has export const runtime = "edge" and imports getPlotUsdPrice from lib/usd-price.ts, which dynamically imports mint.club-v2-sdk. The Edge runtime cannot resolve this module.

Root Cause

lib/usd-price.ts was refactored in PR #896 to use Promise.any() for parallel price fetching. This changed how the bundler processes the dynamic import("mint.club-v2-sdk") — it's now included in the Edge bundle even though it was previously tree-shaken.

Fix

Decouple the OG route from mint.club-v2-sdk:

  1. Move formatUsdValue and formatUsdTokenPrice (pure functions, no SDK dependency) to a separate file like lib/usd-format.ts
  2. Re-export them from lib/usd-price.ts for backward compatibility
  3. In the OG route, import formatUsdValue from lib/usd-format.ts instead
  4. For getPlotUsdPrice in the OG route, fetch via internal API (/api/tokens/plot-price) instead of calling the function directly

Alternative simpler fix: Add export const runtime = "nodejs" to the OG route instead of "edge". This avoids the Edge module restriction entirely. OG image generation doesn't need Edge runtime performance.

Files

  • src/app/story/[storylineId]/og/route.tsx — change runtime or fix imports
  • lib/usd-format.ts — new file with pure format functions (if splitting approach)
  • lib/usd-price.ts — re-export from usd-format (if splitting approach)

Acceptance Criteria

  • vercel deploy succeeds
  • OG images still render correctly with USD price
  • No Edge runtime module errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/T3Assigned to T3 builder agentbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions