Running Cloudflare Workers?

Workers hitting limits or burning CPU? We bring it back.

Workers are a different kind of runtime, not a small Node server. The limits on CPU time, bundle size and subrequests are low on purpose, and most of the trouble we see comes from code written as if a Worker were a Lambda or an Express app. We fit the code to the runtime instead of fighting it.

  • Since 2015Fixing technology
  • FreeEstimates
  • US teamReal engineers

workers-tail.log

still broken

What it is

Cloudflare Workers at a glance

Cloudflare Workers is a serverless platform that runs JavaScript, TypeScript, Rust compiled to Wasm, and a few other languages on Cloudflare's edge network. Unlike AWS Lambda, Workers use V8 isolates instead of containers, which means cold starts of about five milliseconds and no hot-path timers to tune.

The platform first became generally available in 2018, and the ecosystem has grown around it: Workers KV for eventually-consistent key-value storage, Durable Objects for strongly-consistent stateful compute, R2 for object storage, D1 for SQLite at the edge, and Queues for asynchronous workflows. All of it is deployed through the wrangler CLI and billed on a per-request and CPU-time basis.

Type
Serverless edge compute on V8 isolates
First released
2017 private beta, 2018 general availability
License
Proprietary SaaS, usage-based
Maintained by
Cloudflare, Inc.
Typically used for
API edges, request rewriting, auth proxies, image resizing, A/B tests, lightweight backends

The honest version

Cloudflare Workers pros and cons

No technology is all upside. This is where Cloudflare Workers earns its place and where it tends to cause trouble.

Where Cloudflare Workers is strong

  • Near-zero cold startsV8 isolates start in a handful of milliseconds, which makes Workers safe to put on the hot path of every request. Lambda's cold-start debate does not apply here.
  • Deployed close to the userCode runs in the same points of presence the CDN uses, so an auth check or a rewrite happens metres from the browser, not a continent away.
  • A generous free tier100,000 requests per day and 10 ms of CPU per invocation covers plenty of small projects without a credit card attached.
  • A coherent storage storyKV for eventual-consistency reads, Durable Objects for consistent stateful work, R2 for blobs and D1 for SQL. Each of them is reachable from the same Worker with no network hop.
  • Great for traffic-shaping workRequest rewriting, header manipulation, A/B splits and auth gates are the kind of code Workers were designed for, and they run much faster than an origin.
  • Decent local developmentwrangler dev runs the same Workerd runtime locally, so the behaviour you see on your laptop matches production more closely than most edge platforms manage.

Where Cloudflare Workers bites

  • The CPU time limit is low10 ms on the free plan, 30 seconds on paid for a single invocation, and heavier work gets killed. JSON parsing of large payloads and synchronous crypto are easy ways to blow it.
  • Bundle size is tight1 MB on the free tier and 10 MB on paid. A dependency tree that includes moment-with-locales or a heavy PDF library can push over the limit before you notice.
  • KV is eventually consistentWrites take up to 60 seconds to propagate globally, which is fine for config and painful for anything that looks like a session store if you have not planned for it.
  • Not every Node API worksThe runtime is not Node; it implements a subset plus Workers-specific APIs. Packages that reach for fs, net or dgram simply will not run.
  • Observability is thin by defaultwrangler tail is live, Workers Observability covers basic logs and metrics, but anything richer means shipping to Datadog, Sentry or similar through a subrequest you pay for.
  • Durable Objects have a learning curveThey are the right answer for coordination, but reasoning about single-instance actors, migrations and hibernation takes real effort before it becomes natural.

Sound familiar?

Common Cloudflare Workers problems we fix

The Cloudflare Workers problems that bring people to us, and what you have once each one is fixed.

Worker exceeded CPU time limit

A Worker runs out of CPU on real traffic

Signing a JWT per request, parsing a large JSON body, or looping over a cached array that has grown bigger than anyone noticed. The free 10 ms budget disappears quickly.

Hot path inside the budget

Script size 1,245 KB exceeds 1 MB

The bundle is too big to deploy

A dependency pulled in a heavy locale table, an SDK compiled with all providers included, or a polyfill that does not need to be there. Tree-shaking and ESM imports earn their keep.

Bundle slimmed under the cap

Error 1101: Worker threw a JavaScript exception

Workers throwing 1101 under load

An unhandled promise rejection from an upstream fetch, a race against a KV write, or an assumption that a header is always present. Cloudflare returns a generic page and the real cause only lives in tail logs.

Errors surfaced, root cause fixed

KV stale: 60s

Stale KV reads break a feature

A flag flipped in KV and three regions still see the old value a minute later, because KV propagation is eventual and the code treated it as immediate.

Right storage picked per use case

Too many subrequests

The Worker hits the subrequest cap

A fan-out over an upstream API that issues a request per item, or an auth flow chaining three services, and the per-request subrequest limit stops the Worker halfway.

Fan-out batched, cap respected

D1_ERROR: database is locked

D1 locks under concurrent writes

A SQLite-at-the-edge pattern where two Workers write to the same D1 shard at once, serialising into contention. We either shape the writes or move them to Durable Objects.

Concurrent writes handled cleanly

wrangler.toml drift

Production and preview config have diverged

Secrets set from one laptop, environment bindings added through the dashboard, routes wired up by a departed developer. wrangler.toml no longer describes what is actually deployed.

Config back in version control

cost jumped 3x this month

Usage is higher than expected

A Worker on every route when it only needs to run on one, a KV read on every request to a value that never changes, or Durable Objects left running when they could hibernate.

Only the hot path on the edge

What we do

Cloudflare Workers help, from rescue to platform

Hand us one Worker that is misbehaving, or the whole wrangler account.

Rescue
CPU limits hit, 1101 errors in production, deploys refused. We tail the live traffic, find the cause, and ship a fix the same day where we can.
Architecture review
KV versus Durable Objects versus D1 versus R2 picked per use case, with the trade-offs on paper so your team can argue them later.
Performance tuning
Hot paths profiled with wrangler and real traffic, bundle sizes trimmed, subrequest fan-out reshaped into something the runtime can handle.
Migrations
Moving work off a Lambda or Node origin onto Workers, or back the other way when the workload does not fit the runtime.
Durable Objects design
Single-instance actors, hibernation, migrations and backups laid out with a clear mental model, so the team is not scared to touch them.
Managed Tech
A monthly look at invocation costs, CPU percentiles and bundle growth, plus someone on the end of a phone when the edge misbehaves at 3am.

How it works

From first message to fixed

  1. Look Free estimate

    Tell us what's going wrong. We look at it, then tell you plainly what's wrong and what it will cost.

  2. Fix

    We fix the cause, not the symptom. If something is down, getting it back up comes first.

  3. Harden

    Backups, monitoring, updates and access, so the same problem can't quietly come back.

  4. Hand back or stay on

    You get a plain-language write-up. Or we stay on for hosting, upkeep and new work.

Often found together

Running Cloudflare Workers alongside something else?

We work on the whole stack, so the problem can be wherever it actually is.

Questions

Cloudflare Workers questions

Something else? Call+1 737 727 7327

Why does our Worker keep hitting the CPU limit?

The usual suspects are JSON parsing of a large payload, a synchronous crypto operation like RSA signing per request, or a loop over data that has grown since the code was written. We profile the hot path with wrangler and move the heavy piece either to a Durable Object, a background queue, or the origin.

Should we use Cloudflare Workers or AWS Lambda?

Workers if the code lives on the request path, needs to be close to the user, and fits inside the CPU and bundle limits. Lambda if the task is heavier, needs a specific language runtime, or depends on the broader AWS catalogue. The two are not interchangeable and picking the wrong one is one of the most expensive mistakes we see on edge projects.

Is Workers KV safe as a session store?

Only if your application can tolerate a minute of propagation delay between regions. Writes are eventually consistent across the global KV mesh. For sessions that must be strongly consistent, Durable Objects or D1 are the honest answer.

How do we trim a Worker bundle under the 1 MB cap?

Switch to ESM imports, drop heavy dependencies like moment or a bundled AWS SDK, and inspect the output of wrangler with the --minify flag to see what is actually in the bundle. Polyfills are often the quiet weight. We usually find the cap is comfortable once two or three libraries have been replaced.

Why does wrangler deploy fail with no obvious error?

The common causes are a missing account ID in wrangler.toml after a repository clone, an auth token that has expired, routes conflicting with another Worker on the zone, or the bundle silently crossing a size limit. The wrangler --log-level debug flag normally surfaces which one it is.

How much does Cloudflare Workers help cost?

The estimate costs nothing. Send the Worker name and the error you are chasing, and we come back with a scope and a price before we so much as log in.

Free estimate

Workers giving you trouble?

Tell us what you're running and what's going wrong. A person reads it and comes back with an estimate.

  • No charge to find out what it will take
  • If it's urgent, say so

Replies come from a person. By sending, you authorize us to email you back. No marketing.