Skip to main content
All Docs
FeaturesBlockManOSUpdated March 26, 2026

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 previous startsWith('/api/health') pattern.
  • The matcher config 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?

ConcernNode.js ServerlessEdge Runtime
Cold starts200–800 ms (triggers false-positive alerts)None — always warm globally
LatencySingle AWS regionNearest edge PoP
DB dependencyN/A for /api/healthN/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:

RouteReason
/api/portal/[token]/checkoutUses Drizzle ORM with @neondatabase/serverless HTTP driver — not edge-compatible
/api/webhooks/calmony-payRequires Node.js crypto for HMAC signature verification
/api/revalidateUses revalidateTag(), which is Node.js-only
tRPC routesDatabase-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.
Edge Runtime for the Health Endpoint — SaaS Factory Docs