Edge Runtime for the Health Endpoint
Edge Runtime for the Health Endpoint
Released in v1.0.93 (2026-03-26)
Overview
The /api/health endpoint has been migrated from the default Node.js serverless runtime to Vercel's Edge Network runtime. This is a performance-only change with no impact on the endpoint's public contract — it still returns an HTTP 200 with a simple status payload.
What Changed
Runtime
The route handler previously opted into force-dynamic to prevent static caching. It now declares the edge runtime instead:
// src/app/api/health/route.ts
export const runtime = 'edge';
export async function GET() {
return Response.json({ status: 'ok', runtime: 'edge' }, { status: 200 });
}
Response Payload
The JSON response now includes a runtime field for observability:
{ "status": "ok", "runtime": "edge" }
This makes it easy to confirm at a glance — in monitoring dashboards or raw HTTP responses — that the edge deployment is active.
Middleware
src/middleware.ts was updated to ensure the health endpoint is reliably excluded from auth middleware processing:
- An explicit
pathname === '/api/health'equality check was added at the top of the bypass list, replacing the previousstartsWith('/api/health')pattern. - The
matcherconfig was expanded to exclude additional always-public API route prefixes (/api/inngest,/api/trpc,/api/auth,/api/webhooks) from middleware execution entirely, improving clarity and reducing unnecessary middleware invocations.
Why Edge?
| Concern | Node.js Serverless | Edge Runtime |
|---|---|---|
| Cold starts | 200–800 ms (triggers false-positive alerts) | None — always warm globally |
| Latency | Single AWS region | Nearest edge PoP |
| DB dependency | N/A for /api/health | N/A — stateless |
| Compatibility | ✅ | ✅ (no Node-only APIs used) |
The health endpoint is a purely stateless smoke-test ({ status: 'ok' }). It has no database calls, no crypto operations, and no Node.js-specific APIs, making it an ideal candidate for the edge runtime with zero compatibility concerns.
Which Endpoints Were NOT Migrated
Several other API routes were explicitly kept on the Node.js runtime:
| Route | Reason |
|---|---|
/api/portal/[token]/checkout | Uses Drizzle ORM with @neondatabase/serverless HTTP driver — not edge-compatible |
/api/webhooks/calmony-pay | Requires Node.js crypto for HMAC signature verification |
/api/revalidate | Uses revalidateTag(), which is Node.js-only |
| tRPC routes | Database-heavy by design; must stay on the Node runtime |
Impact on Uptime Monitoring
If you use an external uptime monitoring service (UptimeRobot, Pingdom, Better Uptime, etc.) pointed at /api/health, you should see:
- Eliminated false-positive alerts caused by cold-start response times exceeding monitoring thresholds.
- Faster, more consistent response times served from the edge PoP geographically closest to the monitoring probe.
runtime: 'edge'in the response body — you can optionally assert on this field in your monitor's response-body check to confirm edge deployment is active.