Skip to main content
Edge Runtime Limits: What You Can't Do at the Edge

Edge Runtime Limits: What You Can't Do at the Edge

KU
· Founder & Chief Editor
• 8 min read•Updated •

Edge runtimes look like Node but aren't. What actually breaks (CPU caps, memory, bundle size, sockets and filesystems) and how we route around it.

Key takeaways

  • Edge runtimes are V8 isolates, not Node processes.
  • Cloudflare Workers give 128 MB of memory per isolate and meter CPU time, 10 ms on the free plan and 30 seconds by default on paid.
  • Vercel's Edge runtime has no filesystem and caps bundles at 1-4 MB.
  • Keep heavy CPU, big buffers and native modules at the origin.

You can't run CPU-heavy work, buffer large payloads, or use native Node modules at the edge. Edge runtimes are V8 isolates: Cloudflare Workers allow 128 MB of memory and 10 ms of CPU per request on the free plan; Vercel's Edge runtime has no filesystem and a 1-4 MB bundle cap. Keep heavy work at the origin.

Verified against

Cloudflare Workers platform limits, TCP sockets and Node.js compatibility docs (limits page updated 2026-10-29), and the Vercel Edge runtime docs (updated 2026-08-03). Checked October 2026.

We moved an auth-heavy API route to Cloudflare Workers expecting a free latency win. Deploy went green. Then a chunk of requests started failing with error 1102, "Worker exceeded resource limits", under load. The code ran fine locally on Node. That gap (runs on Node, dies at the edge) is the whole story, and it catches people every release.

Edge runtimes are not Node. Workers and Vercel's Edge runtime are V8 isolates. You get JavaScript and the standard web platform (fetch, Request, Response, URL, streams, WebCrypto), and a partial, uneven slice of Node's standard library. The isolate boots in milliseconds because there's no Node process behind it, and that speed is exactly why the APIs you lean on are either missing or emulated.

The four ceilings you'll hit

These are Cloudflare's published numbers as of October 2026; Vercel's Edge runtime has its own, listed in the table below.

CPU time, not wall-clock. This is the one that bit us. Workers meter CPU time (actual compute) separately from wall-clock. The free plan allows 10 ms per request. The paid plan defaults to 30 seconds and can be raised to 5 minutes with limits.cpu_ms. Awaiting a slow subrequest costs wall-clock but almost no CPU, so I/O-bound code is fine. A tight loop hashing a password is pure CPU and blows the budget:

JavaScript
// src/index.js: runs locally, exceeds CPU at the edge under load
export default {
  async fetch(req) {
    const body = await req.text();
    // bcrypt-style work factor = lots of CPU, zero I/O
    const hash = await slowHash(body, { rounds: 12 });
    return new Response(hash);
  },
};

The fix wasn't a faster hash. It was recognizing that per-request key stretching doesn't belong in an isolate at all.

Memory, 128 MB per isolate. That includes the JavaScript heap and WebAssembly. Load a 40 MB model or buffer a large upload fully into memory and the isolate is killed. Streaming is the escape hatch: pass the body through instead of collecting it.

Bundle size. Cloudflare now allows 64 MiB uncompressed on both plans, so size rarely blocks you there. Vercel's Edge runtime is the tight one: 1 MB gzipped on Hobby, 2 MB on Pro, 4 MB on Enterprise. That kills "just npm install it" for anything dragging in a Node polyfill tree; sharp, bcrypt and old Node-first SDKs are too big or too native to bundle.

Subrequests and connections. Each Worker invocation caps outbound subrequests (50 on free, 10,000 by default on paid), and only six connections can be waiting for response headers at once. A fan-out to twenty microservices per request queues behind that limit and adds latency you won't see locally.

You can lower the CPU ceiling to fail fast in staging, or raise it where the work justifies it, in wrangler.toml:

wrangler.toml
name = "auth-api"
main = "src/index.ts"
compatibility_date = "2026-10-01"

[limits]
cpu_ms = 50   # fail fast in staging; raise (up to 300000) only where justified
RuntimeCPU limitMemoryBundle capFilesystemRaw TCP
Cloudflare Workers (free)10 ms per request128 MB64 MiB uncompressedIn-memory /tmp onlyconnect() from cloudflare:sockets
Cloudflare Workers (paid)30 s default, 5 min max128 MB64 MiB uncompressedIn-memory /tmp onlyconnect() from cloudflare:sockets
Vercel Edge runtimeResponse must start within 25 sNot stated on the runtime page1 / 2 / 4 MB gzipped by planNoneNo

Sockets and database drivers: the gap has narrowed

The sharp edge used to be absolute: no TCP, so no normal Postgres, MySQL or Redis driver. That is no longer true on Cloudflare. Workers expose outbound TCP through connect() in cloudflare:sockets, and with Node.js compatibility (on by default from compatibility date 2026-08-04) node:net is supported too. Cloudflare's own advice for Postgres is to go through Hyperdrive, which pools connections for you. The catches are real, though: sockets can't be created in global scope or shared across requests, private-network and localhost targets are blocked, and every open socket counts toward the six-connection limit.

Vercel's Edge runtime still has no socket API, so pg and friends fail there:

JavaScript
// pg opens a TCP socket. Fails in Vercel's Edge runtime.
import { Client } from "pg";
const client = new Client({ connectionString: process.env.DATABASE_URL });
await client.connect();

The pattern that works everywhere is an HTTP-based client talking to a service that holds the real pool: Neon's serverless driver, Supabase's REST API, Upstash for Redis, or a platform database like Cloudflare D1. Same query, different transport.

JavaScript
// Neon over HTTP fetch: no socket, connection pooling lives upstream
import { neon } from "@neondatabase/serverless";
const sql = neon(process.env.DATABASE_URL);
const rows = await sql`select id from users where email = ${email}`;

Even here, watch the subrequest cap: every query is an HTTP call. If the data model is the real question, our take on serverless vs traditional databases covers it.

What breaks, and where it goes instead

Heavy crypto (bcrypt, scrypt, large RSA keygen), image processing (sharp, ImageMagick bindings), PDF generation, code that expects a persistent disk, and anything using child_process or eval don't belong in an isolate. Cloudflare's fs is an in-memory virtual filesystem: /tmp is wiped between requests and counts against the 128 MB. Its child_process and worker_threads are import-only stubs. Vercel's Edge runtime can't read or write files at all and blocks eval and new Function. This is the same tradeoff we walk through in our edge computing playbook: the edge is for cheap, I/O-shaped, latency-sensitive work, and the origin is for everything heavy.

Detection is mostly mechanical. Set your dev runtime to match production (wrangler dev, not plain node) so a missing API fails on your machine, not in prod. Then:

  • Swap Node's crypto for crypto.subtle (WebCrypto). SHA-256, HMAC, AES-GCM and ECDSA are all there and run native.
  • Move CPU-bound or filesystem work to an origin function (regular Lambda, a container) and call it over fetch.
  • Stream request and response bodies instead of buffering.
  • Buy back CPU headroom by caching upstream responses at the edge rather than recomputing.

WebCrypto covered our HMAC signing cleanly:

src/sign.js
const key = await crypto.subtle.importKey(
  "raw", new TextEncoder().encode(secret),
  { name: "HMAC", hash: "SHA-256" }, false, ["sign"]
);
const sig = await crypto.subtle.sign("HMAC", key, new TextEncoder().encode(payload));

On Vercel, the direction of travel is clear: the Edge runtime docs now recommend migrating to Node.js, and they state that Next.js 16.3 no longer supports runtime = 'edge'. If you're on Vercel, the edge question is mostly settled for you.

Questions people ask

What is the CPU time limit for Cloudflare Workers?

As of October 2026, the free plan allows 10 ms of CPU time per HTTP request. The paid plan defaults to 30 seconds per request and can be raised to 5 minutes (300,000 ms) with limits.cpu_ms in the Wrangler config. Only active compute counts: time spent awaiting fetch or other I/O does not. Exceeding the limit returns error 1102.

Can Cloudflare Workers connect to Postgres?

Yes. Workers support outbound TCP via connect() from cloudflare:sockets, and Node's net module works with Node.js compatibility enabled. Cloudflare recommends Hyperdrive for Postgres, which adds connection pooling and query caching. Sockets must be opened inside a request handler, can't reach private IPs or localhost, and count toward the six simultaneous connection limit.

Can I use the filesystem in an edge function?

Not as a disk. Cloudflare Workers expose an in-memory virtual filesystem: /bundle is read-only, and /tmp is writable but empty for each request and counted against the 128 MB memory limit. Vercel's Edge runtime has no filesystem access at all. Anything that needs persistent files belongs in object storage or at the origin.

The call we'd make

Treat the edge as a fast, dumb front door, not a place to port your server. Put routing, auth-token verification, redirects, header rewrites, cache logic and HTTP-based DB reads there: work that's I/O-shaped and finishes in a few milliseconds of CPU. Keep anything that hashes, resizes, buffers big blobs or needs a real disk back at the origin. Run wrangler dev locally and pin a low cpu_ms in staging so the limit shows up on your laptop instead of in a customer's 1102. Fight the isolate model and you'll spend the latency savings debugging CPU timeouts at 2am.

Sources

Explore topics:Cloud
React
Share this post
Cite this article
Plain text

Kiril Urbonas (2026). Edge Runtime Limits: What You Can't Do at the Edge. DevOpsNess. Updated 2026-10-31. https://www.devopsness.com/blog/edge-runtime-limits-what-you-cant-do-at-the-edge

Markdown

[Edge Runtime Limits: What You Can't Do at the Edge](https://www.devopsness.com/blog/edge-runtime-limits-what-you-cant-do-at-the-edge) (Kiril Urbonas, DevOpsNess, updated 2026-10-31)

KU

Kiril Urbonas

Founder & Chief Editor

606 articles
View all articles by Kiril Urbonas

You might have missed

Evergreen posts worth revisiting.