export const config = { matcher: [ // Match specific paths "/dashboard/:path*", // Match all except static files "/((?!api|_next/static|_next/image|favicon.ico).*)", // Match with named params "/users/:id/settings", ],};
Edge Runtime Limitations
Middleware runs in the Edge Runtime, which means:
No Node.js APIs: No fs, path, crypto (use Web Crypto), no Buffer (use Uint8Array)
No dynamic code evaluation: No eval(), new Function()
Limited package support: Many npm packages won't work
Size limit: 1 MB after bundling
No database drivers: Use HTTP-based clients (Supabase, PlanetScale serverless)
Execution time limit: Must respond quickly (typically < 1.5s on Vercel)