Deployment status shows Ready, but all routes return 404 with no runtime logs. Happens with both middleware.ts and proxy.ts patterns, and persists even when middleware is explicitly pinned to Node.js runtime.
Environment
- Framework: Next.js 16.2.4 (App Router, Turbopack)
- Runtime target: Node.js (pinned via
export const runtime = "nodejs"in middleware.ts) - Project plan: Hobby
- Root directory: dca/ (monorepo-style, Next.js app in subfolder)
Build output
Build succeeds cleanly. Route table shows all routes discovered:
Route (app)
┌ ○ /
├ ○ /_not-found
├ ƒ /analysis/[key]
├ ƒ /api/analyses
├ ƒ /api/analyses/[key]
├ ƒ /api/analyze
├ ƒ /api/auth
├ ƒ /api/chat
├ ƒ /api/export
├ ƒ /api/extract
├ ƒ /api/preview
├ ƒ /api/save
├ ƒ /api/version
├ ƒ /api/writer-notes
â”” â—‹ /login
Build error observed
With middleware.ts (both with and withoutexport const runtime = "nodejs"):
The Edge Function “middleware” is referencing unsupported modules: - vc__ns/0/dca/middleware.js: @/lib/session
The imported@/lib/sessionmodule uses only Web Crypto APIs (crypto.subtle.importKey, HMAC-SHA256, sign) — no node:crypto, no fs, no other Node-only imports. Manually confirmed by reading the source.
Pinning middleware to Node.js runtime (export const runtime = "nodejs"at top of middleware.ts) should bypass the Edge bundler entirely, but the same error appears in the build output regardless.
Symptoms at runtime - All routes return 404 NOT_FOUND (example ID: sfo1::jqlpd-1776919508683-c3e88181f651)
- Runtime Logs show zero entries per request — suggests requests aren’t reaching any deployed function
- Confirmed Vercel Authentication / Deployment Protection is disabled
- Tested in fresh incognito windows; same result on production URL and deployment-specific URL
What I’ve tried
- Migrated middleware.ts → proxy.ts per Next.js 16 deprecation notice (self-contained, no imports from other modules) — same 404 behavior
- Reverted to middleware.ts, added explicit
export const runtime = "nodejs"— Edge bundler error returns - Confirmed root directory is
dca, all env vars set for Production environment, Next.js 16.2.4 detected in build logs - Forced redeploys with cache cleared — no change
Questions
- Is the runtime: “nodejs” pin being honored by Vercel’s Edge bundler in this deployment path? The persistent Edge-related error suggests possibly not.
- What TypeScript compilation artifacts or transitive references in Web Crypto-only code might be tripping Vercel’s Edge-detection heuristic?
- Is there a known workaround for Next.js 16 middleware on Vercel when the Edge bundler rejects a module that is actually Edge-compatible?
Repo is private; happy to share details via DM or recreate a minimal reproduction if helpful.Questions that get answered the fastest are the ones with relevant info included in the original post. Be sure to include all detail needed to let others see and understand the problem! →