Hacker News new | ask | show | jobs
by gorbypark 2671 days ago
Do you have any details about using Cloudflare Workers as an API gateway?
1 comments

Check out the boilerplate here for workers:

https://github.com/detroitenglish/cloudflare-worker-webpack-...

Then invoke lambda with this:

https://github.com/mhart/aws4fetch

Important to note that workers have a 15s timeout, so this is really only good for routing. You probably don’t want this to manage tasks that could potentially take longer.

> Important to note that workers have a 15s timeout

Not true -- the timeout on outgoing HTTP requests is (I think) 100 seconds (or unlimited as long as data is streaming).

The 15-second limit you may be thinking of is that Workers used to not let you start new outgoing HTTP requests 15 seconds into the event, but already-started requests could continue. This limit was recently removed -- instead, Workers now cancels outgoing requests if the client disconnects, but as long as the client is connected, you can keep making new requests. This was changed to support streaming video use cases where a stream is being assembled out of smaller chunks.

(I'm the tech lead for Workers.)

Didn’t know that! Thanks for chiming in.