cloudflare/vinext

Edge runtime API routes and OG image routes return 500/404

已關閉

#1,338 建立於 2026年5月20日

 (1 則留言) (0 個反應) (0 位負責人)TypeScript (371 個分叉)github user discovery
adapter-api-e2ehelp wanted

倉庫指標

星標
 (8,563 顆星)
PR 合併指標
 (平均合併 1天 1小時) (30 天內合併 462 個 PR)

描述

This issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext main vs Next.js v16.2.6, 2026-05-20).

Problem

Edge runtime API routes in the Pages Router return 500 errors. Pages Router API routes using ImageResponse (OG image generation) return 404. App Router OG image routes with custom fonts return 500.

Expected: 200
Received: 500  // /api/hello (edge API route)

Expected: 200
Received: 404  // /api/og (Pages Router ImageResponse)

Expected: 200
Received: 500  // /font/opengraph-image (custom font OG)

Estimated Impact

~15 test failures across the deploy suite.

Affected Test Suites

  • test/e2e/edge-pages-support/index.test.ts (2 failures)
  • test/e2e/og-api/index.test.ts (1 failure)
  • test/e2e/app-dir/metadata-font/metadata-font.test.ts (1 failure)
  • test/e2e/edge-pages-support/edge-document.test.ts
  • test/e2e/edge-runtime-node-compatibility/edge-runtime-node-compatibility.test.ts
  • test/e2e/streaming-ssr-edge/*.test.ts
  • test/e2e/edge-compiler-can-import-blob-assets/*.test.ts

Recommendation

  1. Reproduce first in vinext's own test suite. Add a test with a Pages Router edge API route (export const runtime = 'edge') and verify it returns a proper response. Add a test for an OG image route handler. Confirm they fail.

  2. Study how vinext handles edge runtime routes. The edge runtime environment may not be properly set up for pages/api/* routes in the production server.

  3. Fix Pages Router API route matching for edge runtime. Ensure pages/api/* routes with export const runtime = 'edge' are properly detected and executed.

  4. Fix OG image route handling. Ensure ImageResponse from next/og works in both Pages Router API routes and App Router metadata routes. Custom font loading (fetch() for font files) may need special handling in the Cloudflare Workers environment.

貢獻者指南