Nice article on optimising tRPC on serverless functions, thanks!
Some of my thoughts: This is a problem that manifests only if you use serverless. also, unfortunately the solution shown is service-specific. The code to split tRPC routers into multiple API routes is different for Next vs. Cloudflare Workers, and so on.
I've enjoyed engineering serverless applications over the past few years, but there are some weird challenges like this one. Other issues (I use Cloudflare Workers) is that it:
- runs your code on V8 and not NodeJS, so you don't have the Node APIs (though it tries to add compatibility).
- has CPU limit: makes it impossible to resize images or even hash passwords using bcrypt.
- Running locally has been a pain (though emulators / miniflare have been developed in recent years).
I would suggest most projects should avoid serverless and stick with conventional technology.
Some of my thoughts: This is a problem that manifests only if you use serverless. also, unfortunately the solution shown is service-specific. The code to split tRPC routers into multiple API routes is different for Next vs. Cloudflare Workers, and so on.
I've enjoyed engineering serverless applications over the past few years, but there are some weird challenges like this one. Other issues (I use Cloudflare Workers) is that it: - runs your code on V8 and not NodeJS, so you don't have the Node APIs (though it tries to add compatibility). - has CPU limit: makes it impossible to resize images or even hash passwords using bcrypt. - Running locally has been a pain (though emulators / miniflare have been developed in recent years).
I would suggest most projects should avoid serverless and stick with conventional technology.