worker-tools / workers.js.org

Worker Environments are the new standard for authoring HTTP servers in JavaScript.

Home Page:https://workers.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CloudFront Functions and other isolate-based runtimes

hansottowirtz opened this issue · comments

While not implementing the Service Worker API, AWS CloudFront Functions are very similar to Cloudflare Workers and Deno Deploy in that it's also a lightweight, isolated Javascript runtime (but with different platform APIs).
I assume it would be possible to implement an adapter for the Service Worker API around the available API, and it that case I think it would be very similar (apart from use cases). There's not much documentation available on the internals of CloudFront Functions, but they're not using V8 like CF Workers and Deno Deploy, instead using another runtime and process isolation.

Are you interested in adding it to the list as well? Or would you rather keep it to Service Worker API-based runtimes?

Not affiliated to AWS by the way, just wondering. I assume there will be a more of these JS-only isolate-based runtimes in the future, but I'm not sure if they'll be implementing the Service Worker APIs.

Platform APIs: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/functions-javascript-runtime-features.html
General docs: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-functions.html
Blog post: https://aws.amazon.com/blogs/aws/introducing-cloudfront-functions-run-your-code-at-the-edge-with-low-latency-at-any-scale/

Hi, thanks for your interest.

Or would you rather keep it to Service Worker API-based runtimes?

That is the plan, yes.

To be fair, both Deno Deploy and Cloudflare Workers have quietly dropped support for Service Worker API, specifically the globalfetch event and respondWith pattern1, so whether something qualifies as a "Worker Environment" mostly falls on how many of the other browser APIs are implemented (Fetch API, Streams, WebCrypto, etc.) but to my knowledge AWS doesn't do that either.

If there was an adapter that implemented a good chunk of the Web APIs on top of AWS, that would certainly be interesting.

Footnotes

  1. I should probably clarify: Deno never supported it to begin with, they simply stopped pursuing it, while CF Workers still supports it as part of their classic workers, but the new module/export workers do not.