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:
- Move
formatUsdValue and formatUsdTokenPrice (pure functions, no SDK dependency) to a separate file like lib/usd-format.ts
- Re-export them from
lib/usd-price.ts for backward compatibility
- In the OG route, import
formatUsdValue from lib/usd-format.ts instead
- 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
Problem
ALL deployments to Vercel are failing with:
The OG image route (
src/app/story/[storylineId]/og/route.tsx) hasexport const runtime = "edge"and importsgetPlotUsdPricefromlib/usd-price.ts, which dynamically importsmint.club-v2-sdk. The Edge runtime cannot resolve this module.Root Cause
lib/usd-price.tswas refactored in PR #896 to usePromise.any()for parallel price fetching. This changed how the bundler processes the dynamicimport("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:formatUsdValueandformatUsdTokenPrice(pure functions, no SDK dependency) to a separate file likelib/usd-format.tslib/usd-price.tsfor backward compatibilityformatUsdValuefromlib/usd-format.tsinsteadgetPlotUsdPricein the OG route, fetch via internal API (/api/tokens/plot-price) instead of calling the function directlyAlternative 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 importslib/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 deploysucceeds