Edge function
An edge function is a small serverless function that runs at the network edge — geographically close to the user — typically on Cloudflare Workers, Deno Deploy, Vercel Edge, or AWS Lambda@Edge.
Edge functions run closer to users than traditional serverless functions, cutting latency by 50-150ms for global apps. They commonly handle authentication, AB testing, geolocation, rewrites, and lightweight LLM gateways. Limits: short execution time (often 30s max), limited memory, restricted Node.js compatibility (V8 isolates instead of Node), no direct file system. For AI apps in 2026 edge functions are commonly used for LLM gateway logic — auth, routing, rate limiting — while the actual LLM inference runs in a region closer to the model provider.
When to use edge function
- Auth, AB testing, geolocation logic.
- LLM gateway and routing.
- Lightweight personalisation.
Common mistakes
- Trying to run heavy compute at the edge — short runtimes hurt.
- Forgetting cold-start in long-running edge regions.
FAQ
What is edge function?
An edge function is a small serverless function that runs at the network edge — geographically close to the user — typically on Cloudflare Workers, Deno Deploy, Vercel Edge, or AWS Lambda@Edge.
When should I use edge function?
Auth, AB testing, geolocation logic. LLM gateway and routing. Lightweight personalisation.
What are the most common mistakes with edge function?
Trying to run heavy compute at the edge — short runtimes hurt. Forgetting cold-start in long-running edge regions.
Related terms
- Cold start (inference) — Cold start is the delay incurred when a serverless inference function loads its model into GPU memory for the first time after being idle — typically 5-60 seconds for large LLMs.
- Serverless database — A serverless database scales compute and storage independently and bills based on actual use — no fixed instance provisioning — typical of Neon, PlanetScale, Supabase, Convex in 2026.
- Router fallback — A router fallback is a chain of model providers that the application tries in order — failing over from primary to secondary to tertiary on 429s, 500s, or quality thresholds.
Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/edge-function.md.