Cloudflare Workers support
We’ve added support for edge-runtimes like Cloudflare Workers to the Bucket NodeSDK.
To get started using Cloudflare Workers, set the node_compat
flag in your wrangler file and use EdgeClient
instead of BucketClient
.
To avoid any flag evaluation latency, Bucket maintains a cached set of feature definitions in the memory to decide which features to turn on for which users/companies.
The new EdgeClient uses a new strategy to keep these feature definitions fresh: The first request to a new worker instance fetches definitions from Bucket's servers, while subsequent requests use the cache. During an invocation when the cache has expired the request will be served using the stale cache while it’s being updated in the background, so response times are not affected.
This background work may increase wall-clock time for your worker, it will not measurably increase billable CPU time.
For more details, check out the docs that include a deployable example.