I’ve seen this debate resurface on X again lately, so here are my thoughts. I don’t think people realize the two aren’t exactly interchangable. It all boils down to whether or not your code needs to run on the edge, your ecosystem, and what kinda state/storage you need.
Latency
CF workers run on the edge, meaning low latency requests and responses. Great for stuff like routing, auth, cache, and lightweight API endpoints. They also typically have a very fast startup time and no cold starts.
Lambdas run in an AWS region. So if your systems are already in AWS, that’s great. However, the biggest pain point with lambdas are the cold starts. Using Node.js with a VPC, you can easily expect to see times for cold starts fall between 1-2 seconds.
Runtimes
CF workers only support JavaScript out of the box. For everything else, you have to use WASM which is another headache on its own.
Lambdas support all the major runtimes (Node, Python, Java, Go, .NET, etc) and are better when you need “real server” compatibility.
Networking & state
CF workers are edge-native and assume public access. Clients I’ve worked with that use CF workers typically use KV, Durable Objects, or R2 for state. This is great if you need low-latency global reads and edge-native state, but its undoubtedly the inferior choice if your app depends on private AWS services or VPC-first architecture.
Lambdas on the other hand are great if you’re already in the AWS ecosystem. If your infra lives behind private networking or you rely on traditional relational databases, Lambda is just superior.
Developer experience
Almost all AWS services are notorious for bad DX, so not a suprise that CF workers takes this one. Lambdas do have more more “mature” enterprise controls, IAM, logging, etc. but for most people those are just extra settings for them to fuck something up.
Verdict
As is the answer to everything, it depends. Technology is never a binary decision, and you shouldn’t treat it as such.
Pick CF workers if:
- You need globally distributed APIs
- You want edge caching, routing, and rate limiting
- You want to avoid VPC/infra complexity
Pick AWS Lambda if:
- You’re already in the AWS ecosystem
- You need background jobs and queues
- You’re using a non-JS runtime
Though, that’s not to say you shouldn’t use Lambda if you are using a JS runtime. After all, your Next.js API routes are deployed to it.