cloudflare/vinext

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

Fermée

#1 338 ouverte le 20 mai 2026

 (1 commentaire) (0 réaction) (0 personne assignée)TypeScript (371 forks)github user discovery
adapter-api-e2ehelp wanted

Métriques du dépôt

Stars
 (8 563 étoiles)
Métriques de merge PR
 (Merge moyen 1j 1h) (462 PRs mergées en 30 j)

Description

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.

Guide contributeur