Menu

Post image 1
Post image 2
1 / 2
0

I rewrote my auth library to run on Cloudflare Workers. Here is what broke.

DEV Community·GDS K S·about 1 month ago
#7cyZZxCa
Reading 0:00
15s threshold

Most TypeScript auth libraries assume Node.js. They reach for crypto.randomBytes , Buffer , the Node fs module, sometimes process.env directly. That works on Vercel serverless, AWS Lambda with the Node runtime, Railway, Fly. It does not work on Cloudflare Workers. Workers do not have Node. They have Web APIs. crypto means Web Crypto, not the Node crypto module. Buffer is gone. fs is gone. process.env does not exist. Bindings are injected into a request handler. I rewrote KavachOS to run on Workers in February. Here is what I had to change, in case you are going through the same migration. Why bother Workers are cheap. They run close to the user. They cold-start in under 5ms. For an auth library that gets called on every authenticated request, that latency floor matters. If your auth library adds 80ms of cold start every time someone hits an endpoint, your app feels slow even when the actual logic is fast. Most AI agent infrastructure is also moving to the edge.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More