Hacker News new | ask | show | jobs
by k__ 2628 days ago
Yes, I have the feeling the whole "replicate locally" goes in the wrong direction.

You're just lying to yourself when saying local is the same as cloud...

2 comments

If your cloud edge functions only (completely stateless functions or containers run without any directly attached data stores) then you can pretty reliably simulate it locally - you can configure your own dev machine as an edge node.

Stuff like Lambda@Edge, Cloudflare Workers etc all have very strictly defined APIs that are executed on V8 (modified for security, but not enough to be incompatible). If you run a pure function on your local machine you can be pretty sure it’ll run on the edge.

We’ve already done this quite well with Docker - the image you run locally is cryptographically the same binary bytes you’ll run on production. It’s not that surprising to see it for edge functions.

Sure if you doing unit-tests/one function that works.

But as far as I know, unit tests aren't the place to be in terms of serverless testing.

Integration and E2E tests are much more important and that's where the whole "run locally" stuff breaks down rather quickly.

Why? They're just computers, what makes your local machine that different from a Netlify server?
Because functions are small self-contained stateless bits of code, they don't need much testing by themselves.

You need to test them with the services they are using and replicating your whole cloud infrastructure locally is nearly impossible.

Maybe they'll tell me I'm wrong, but Netlify strikes me as not targeting people who need a "whole cloud infrastructure" (since they don't offer many services), but a static site with a few simple backend functions.
Cloud be, yes.