A Durable Object namespace binding.
The binding name
The Durable Object namespace
A binding of a type this package has no facade for — Hyperdrive, Vectorize, Workers AI, Analytics Engine, and anything Cloudflare ships next.
The caller's own type for the binding
The binding name
The binding
Reports whether a binding of that name is present.
The binding name from wrangler.toml
true when the Worker carries it
A KV namespace binding.
The binding name
The KV namespace
Every binding name the Worker carries, sorted.
The binding names
A Queues producer binding.
The binding name
The queue producer
A service binding to another Worker.
The binding name
The service binding
The Worker's string variables and secrets.
The same values reach runtime.env when the application passes env to
RuntimePlugin; this accessor exists so a consumer holding only the
bindings service does not need the runtime as well.
The string entries of the Worker's env
Keeps the invocation alive until the promise settles, so work can outlive the response.
Cloudflare allows up to 30 seconds after the invocation ends, shared across every call in one request. A rejection is logged rather than left unhandled. Off Cloudflare Workers — with no host injected — the promise simply runs, because no runtime there cuts work off at the response.
The background work
Typed access to a Cloudflare Worker's platform bindings.
Resolve it from the service registry under
CAPABILITIES.CLOUDFLARE.Every accessor throws
CloudflareBindingMissingErrorfor a name the Worker does not carry, rather than returningundefined: a missing binding is a deployment error, and failing with the requested name plus the names that are present says what to fix. Usehaswhen absence is an expected case.Binding methods may only be called inside a request. The Workers platform prohibits I/O in top-level scope, so holding a binding at registration time is fine while reading through it there is not.
Example
Since
0.2.0