Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - fastly support #35

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

WIP - fastly support #35

wants to merge 4 commits into from

Conversation

chrisradek
Copy link
Contributor

@chrisradek chrisradek commented Nov 21, 2023

Current state of PR

This PR adds support for running the edge sdk on Fastly Compute@Edge. Previously this was only tested and ran on Cloudflare Workers.

Cloudflare Workers versus Fastly Compute@Edge

Feature Cloudflare Workers Fastly Compute@Edge
Language support JavaScript JavaScript compiled to WASM
Streaming HTML modification HTMLRewriter Hand-crafted solution with transform streams or buffering
Geo data request.cf event.client.geo
Request construction Supports passing in full Request as 2nd param Will not use request.body if passed as 2nd param
fetch works similar to node.js requires passing in backend field unless dynamic backends are enabled
automatic decompression gzip/deflate, maybe brotli? gzip if passed as request option

Currently working in PR

  • Proxy origin
  • AJS injection
    • Currently buffers whole HTML file, need to take advantage of TransformStreams
  • AJS assets proxy
  • TAPI proxy
  • reset endpoint
  • server-side cookies
  • writeKey redaction

Features still in progress

  • Edge context
    • geo data exists in fastly, but not on the request object
  • profiles API
  • Engage incoming webhook
  • client side traits
  • edge variations

Testing progress

Created a new edge-sdk-integration-tests package to run integration tests in as close to the real environments as possible (without actually deploying services).

This uses wrangler v3, which utilizes workerd, for cloudflare workers, and the fastly cli's fastly compute serve command for building/running fastly services locally. Tests currently all pass locally, but need to update CI so that the fastly CLI is available to use.

Notes

Will probably break this up into smaller PRs once it's ready for review to keep them somewhat sane in size.

Copy link

changeset-bot bot commented Nov 21, 2023

⚠️ No Changeset found

Latest commit: abfd195

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant