Expand description
wrangler.toml generation per Worker (v0.8 §4.4 / §4.5).
Each context becomes a Cloudflare Worker with its own wrangler config.
Service Bindings are declared for every consumed context. Durable
Object bindings + exports entries are declared for every agent.
Modules§
- environment
- The
[env.<name>]block of a named-environment deploy (back-half paydown 1C.2, Decision A of #4039).
Structs§
- Class
Tombstones - State-migrations S3 (#2248): one context’s agent class renames
(
(old, new)) and removals, asexportstombstones.
Constants§
- COMPATIBILITY_
DATE - Compile-time pinned compatibility date. Cloudflare uses this to lock
Workers runtime behaviour. When to bump it, and the gate a bump must pass,
is the policy in
design/bynk-release-discipline.md(“Part 3 — The Workers compatibility date”, #1677): reviewed at each release, and moved only after the workerd smokes pass on the new date. - CONTAINERS_
MANIFEST - The name of the manifest beside a Worker’s
wrangler.tomlthat states what[[containers]]does not: each container’s capability,@builddirectory and@instanceType, whichbynk deployplans and checks from. - CONTAINERS_
MANIFEST_ VERSION - The version of
CONTAINERS_MANIFEST’s layout. - CONTAINERS_
UNAVAILABLE_ VAR - #3477 (slice C3): the
wrangler dev --varthat tells a generated container class its containers are off (bynk devwithout Docker), so a call faults naming Docker. The runtime’s own copy isCONTAINERS_UNAVAILABLE_VAR(container.ts);xtask/tests/env_protocol.rskeeps the two equal (#4003). Thewrangler dev --varthat tells a generated container class its containers are off (bynk devwithout Docker). - D1_
MIGRATIONS_ DIR - P4b (#2608): the directory beside a Worker’s
wrangler.tomlholding itsD1databases’ migrations, one subdirectory per database, as the project’s ownmigrations/folder does. - DEFAULT_
COMPATIBILITY_ FLAGS - #1890: the compatibility flags every emitted Worker carries, ahead of the
project’s own (
bynk.toml’s[workers] compatibility_flags). - EVENTS_
FANOUT_ CLASS_ NAME - Events track, slice 0 (spine #936, ADR 0284): the class name of a
publishing context’s fan-out Durable Object (
emitter::events_fanout). Shared withemitter::workers(theEnvfield name +deps. __eventsDispatchcall it drives) andemitter::events_fanout(the class this name must actually export) so the three can never drift apart. - FOREIGN_
SERVICE_ DOUBLE_ STATUS - Interop I5 (#1972): the status of the stand-in for a foreign Worker that
bynk devbinds by default and the integration test harness binds always. 503, not a 2xx: the stand-in served nothing, and code that ignores the status should not mistake it for the Worker’s answer. - HYPERDRIVE_
MANIFEST - Hyperdrive H5 (#3322): the file beside a Worker’s
wrangler.tomlthat says which of its[[hyperdrive]]bindings are MySQL, and each one’s@tlsmode.wrangler.toml’s stanza names neither (a Hyperdrive config’s database kind and TLS mode are the config’s, not the binding’s), andbynk deployneeds both to make the config. It is written only for a Worker with aMySqlinstance, so aPostgres-only project’s output is unchanged, and it holds names and modes, never a connection string. - HYPERDRIVE_
MANIFEST_ VERSION - The manifest’s version. A reader refuses one it does not know.
- KV_
BINDING_ NAME - The bare
Kv’s binding (KV), re-exported forbynk deploy, which reads generated configs and tells the bare namespace from derived instances by it (S4b, #1967). The fixed Worker binding name for the Kv namespace (decision C1, v0.19): one namespace, one[[kv_namespaces]]stanza, oneenv.KVfield. - KV_
NAMESPACE_ ID_ PLACEHOLDER - Deploy-time sentinel in generated Worker configuration. The driver replaces this with the persistent Cloudflare KV namespace id immediately before a remote Wrangler command runs.
- VECTORIZE_
MANIFEST - #3479: the file beside a Worker’s
wrangler.tomlthat states each[[vectorize]]binding’s index configuration.wrangler.toml’s stanza names only the index; its dimensions, metric and metadata indexes are whatbynk deploycreates it with and checks it against, and Cloudflare cannot change them afterwards. Written only for a Worker with aVectorizeinstance, so any other project’s output is unchanged. - VECTORIZE_
MANIFEST_ VERSION - The manifest’s version. A reader refuses one it does not know.
- WRANGLER_
MIN - #1732: the wrangler minimum.
bynk doctorwarns about a wrangler below it, andbynk devprints the same warning before serving.
Functions§
- analytics_
dataset_ name - P3b (#2582): the account-facing name of an
Analyticsinstance’s dataset,<worker>_<capability>in snake case:shop-cartandANALYTICS_SIGNUPSgiveshop_cart_signups. Underscores, not R2’s hyphens, because the dataset is the table name in the SQL API, where a hyphen would need quoting in every query.bynk deployenvironment-qualifies it (shop_cart_signups_staging). - asset_
headers - #1883, slice 1b: the
_headersfile written into a Worker’s assets directory beside its files. Every served path carries its content hash, so a file underbynk_check::assets::SERVED_PREFIXnever changes and may be cached for a year. Without it the platform’s default ismax-age=0, must-revalidate. The glob is built from the prefix, so the two cannot drift (review of #1904). - assets_
block - #1883, slice 1b: the
[assets]block for a Worker that ships static files.directoryis the Worker’s own assets directory (crate::emit_model::WORKER_ASSETS_DIR), beside — never containing — its compiled code. The three routing settings are set explicitly rather than inherited (#1883 [DECISION C], checked against the wrangler reference): - bind_
vectorize_ for_ dev - #3479: a Worker’s generated
wrangler.tomlforbynk dev. AVectorizehas no local simulation, so each[[vectorize]]entry whose binding is indevis pointed at that index of the developer’s own withremote = true, and the entries not in it are removed: the instance is unbound, and a call to it faults saying how to bind it.[vars]gains one<binding> = "<dimensions>:<metric>"per bound index (declared), which the binding checks the index against on its first call.devanddeclaredare keyed by binding. The text is unchanged when there is no[[vectorize]]. - compatibility_
flags - #1890: the flags a Worker’s
wrangler.tomlcarries, and the duplicates dropped on the way.DEFAULT_COMPATIBILITY_FLAGScome first, thenextra(the manifest’s list) in order. A name already present, whether a default or earlier inextra, is dropped and returned in the second list, once per extra occurrence, for the caller to warn about. Names are not otherwise checked. - d1_
database_ entries - P4a (#2602): a generated
wrangler.toml’s[[d1_databases]]entries as(binding, database_name), in file order; an entry missing either is skipped. - d1_
database_ id_ placeholder - P4a (#2602): the placeholder
database_idof D1 bindingbinding, whichbynk deployreplaces with the id it records in the ledger. - d1_
database_ name - P4a (#2602): the account-facing name of a
D1instance’s database. It moved to the checker with P4b (#2608), which names each instance’s migrations directory by it. P4a (#2602): the account-facing name of aD1instance’s database,<worker>-<capability, kebab>:shop-cartandD1_ORDERSgiveshop-cart-orders. D1 database names are scoped to the account, as R2 bucket names are.bynk deployenvironment-qualifies it. - dataset_
var_ name - #3513 B: the
[vars]entry that carries anAnalyticsbinding’s dataset name to the Worker (ANALYTICS_SIGNUPSgivesBYNK_DATASET_ANALYTICS_SIGNUPS). - drop_
mtls_ certificates - #3513 A:
textwithout the[[mtls_certificates]]entries bound asbindings.bynk devdrops a certificate no deploy has linked from its development copy: markedremote = truewith a name where an id belongs, it could fail wrangler’s whole startup, and unbound the Worker serves and only a call through the binding fails. Unchanged text when none matches. - edge_
cache_ block - L7 (#2414):
[cache]turning Workers Cache on for a Worker whose context declares anEdgeCacheinstance. Cloudflare then answers aGETorHEADfrom its edge cache when it holds a fresh response, without running the Worker, and stores what the Worker sends as RFC 9111 allows: which is why such a Worker sendsno-storeon every response but a@cacheroute’s2xx(workers_entry). A Worker without an instance gets no stanza. - emit_
containers_ manifest - #3477 (slice C2):
CONTAINERS_MANIFESTfor a Worker’s bindings, orNonewhen it has no container.instance_typeisnullwhen the declaration gives none, which the platform runs aslite. - emit_
hyperdrive_ manifest - The
bynk-hyperdrive.jsonof a Worker withbindings, orNonewhen it has noMySqlinstance. Thetlsfield is the@tlsmode as the source wrote it (requiredwhen it wrote none). - emit_
vectorize_ manifest - The
bynk-vectorize.jsonof a Worker withbindings, orNonewhen it has noVectorizeinstance. - emit_
wrangler_ toml - P6.x cutover slice 2 (#1191, narrowed from #1187):
crons/queuesarrive pre-collected, sorted and deduped by the caller (project.rs’s ownemit_wrangler_tomlcall site) rather than being walked here offtable.services. Both used to match a handler’s cron-schedule kind and a service’s queue-binding protocol directly, straight off the syntax tree — this file’s entire raw-syntax footprint, per #1191’s own grounding. Relocating just these two matches removedwrangler.rsfrom theast_importersprobe outright — nobynk_modelequivalent exists to route through instead: nothing builds a project-wide service IR at the call site (#1191’s Framing), and after #1542’s Slice D2 nothing builds one anywhere. - enable_
agent_ inspection - #3581 (the dev agent-inspection track): the development copy of a Worker’s
config binds the registry Durable Object its
index.tsre-exports (BynkInspectRegistry) as__BYNK_INSPECT_REGISTRY, and declares its class, SQLite-backed like every other. Only ever applied to the development copy: the configbynk deployreads is a different build, which never carries it. A Worker whose entry does not re-export the class (one that hosts no agent) is returned unchanged, as is one that already has it. - enable_
remote_ ai_ search - #3480: the config
bynk devserves, where each[[ai_search]]entry also carriesremote = true: AI Search has no local simulation, so wrangler proxies the binding to the deployed instance. Only ever applied to the development copy; the configbynk deployreads never carries it. Unchanged text when there is no such entry. - enable_
remote_ analytics_ sql - #3513 B: the config
bynk devserves, where the[analytics]table (the Analytics SQL binding) also carriesremote = true: there is no local implementation of it, so wrangler runs the query on Cloudflare. Only ever applied to the development copy. Unchanged text when there is no such table. - enable_
remote_ mtls - #3513 A: the config
bynk devserves, where each[[mtls_certificates]]entry also carriesremote = true: there is no local simulation of an mTLS binding, so wrangler runs it on Cloudflare. Only ever applied to the development copy; the configbynk deployreads never carries it. Unchanged text when there is no such entry. - foreign_
service_ double_ body - Interop I5 (#1972): the body of that stand-in’s every response, saying
what it is.
bynk devadds how to reach the real Worker instead. - hyperdrive_
entries - Hyperdrive H2 (#3319): a generated
wrangler.toml’s[[hyperdrive]]entries as(binding, id), in file order; an entry missing either is skipped. In a freshly generated fileidis the placeholder. - hyperdrive_
id_ placeholder - Hyperdrive H1 (#3318): the placeholder
idof Hyperdrive bindingbinding, whichbynk deployreplaces with the id of its Hyperdrive config. - kv_
bindings_ needing_ ids - The bindings of a generated
wrangler.toml’s[[kv_namespaces]]entries whoseidis still that binding’s deploy-time placeholder (kv_id_placeholder), in file order: whatmaterialise_kv_namespace_idswould patch. Exposed so a caller can learn which ids it needs before doing the (possibly fallible) work of finding them, asbynk dev --remotedoes before it reads the ledger. Empty for a config with no KV, or one already materialised. - kv_
id_ placeholder - The deploy-time placeholder a
[[kv_namespaces]]entry forbindingcarries untilbynk deploymaterialises it:KV_NAMESPACE_ID_PLACEHOLDERfor the bareKV,kv_instance_id_placeholderfor a derived instance (S4b, #1967). - kv_
instance_ id_ placeholder - S4a (#1966): the deploy-time id placeholder of a derived KV instance’s
[[kv_namespaces]]entry:KV_SESSIONS→<KV_SESSIONS_ID>. - kv_
instance_ title - S4b (#1967): the account-facing title stem of a derived instance’s KV
namespace,
<worker>-<capability, kebab>:shop-cartandKV_SESSIONSgiveshop-cart-sessions,KV_PRICE_CACHEgivesshop-cart-price-cache. Read off the binding, which is a function of the capability’s name, so a renamed capability is a new title.bynk deployenvironment-qualifies it. - materialise_
adopted_ container_ images - #3477 (slice C2):
textwith each adopted container image named in the[containers.images.<capability>]entry ofenvironment(the top level fordefault, else[env.<name>]): the entry’sdockerfile,build_contextandbuild_varsgo, andimagetakes the digest-pinned reference, sowranglerbuilds nothing for it.imagesmaps a capability to its reference. An adopted capability with no entry to rewrite is an error: it would be built after all. - materialise_
d1_ databases - P4a (#2602): point
[[d1_databases]]entries at their deployed databases, structurally, by binding: each entry whose bindingdatabaseslists gets that(database_name, database_id). Unchanged text when nothing differs, asmaterialise_r2_bucket_names. - materialise_
hyperdrive_ ids - Hyperdrive H2 (#3319): point
[[hyperdrive]]entries at their configs, structurally, by binding: each entry whose bindingidslists gets that id. Unchanged text when nothing differs, asmaterialise_d1_databases. Only an id is written: the connection string is never an input here. - materialise_
kv_ namespace_ ids - Materialise deploy-time KV namespace ids in a generated
wrangler.toml’s text, structurally, by binding (S4b, #1967). Each[[kv_namespaces]]entry whose binding has an id inids, and whoseidis currently exactly that binding’s placeholder (kv_id_placeholder), gets the id; the decor around the value (the# set at deploy timenote) is kept. - materialise_
mtls_ certificates - #3513 A: point
[[mtls_certificates]]entries at their certificates’ ids, structurally, by binding. Unchanged text when nothing differs. - materialise_
r2_ bucket_ names - P5 (#2323): point
[[r2_buckets]]entries at their deploy-time bucket names, structurally, by binding: each entry whose bindingnameslists gets thatbucket_name. The generated name is the unqualified derived one (r2_bucket_name); an environment qualifies it. Unchanged text when nothing differs, asmaterialise_kv_namespace_ids. - materialise_
ratelimit_ namespace_ ids - P3 (#2342): write each rate limiter’s allocated
namespace_idover its placeholder, structurally, byname, leaving itssimple = { … }and comment as they are. Unchanged text when nothing matches, asmaterialise_kv_namespace_ids. - materialise_
stored_ secret_ stores - #3301: point
[[secrets_store_secrets]]entries at their stores’ ids, structurally, by binding. Unchanged text when nothing differs. - materialise_
vectorize_ index_ names - #3479: point
[[vectorize]]entries at the indexesbynk.tomladopts, structurally, by binding. An adopted index keeps the name it has on the account (never the derived, environment-qualified one), so it is written into the top-level entries for the default environment and into[env.<environment>]’s for a named one. Unchanged text when nothing differs, asmaterialise_r2_bucket_names. - mtls_
certificate_ bindings - #3513 A: the binding of each
[[mtls_certificates]]entry, in file order. - r2_
bucket_ entries - A generated
wrangler.toml’s[[r2_buckets]]entries as(binding, bucket_name, jurisdiction), in file order; an entry missing a binding or a name is skipped. - r2_
bucket_ name - P5 (#2323): the account-facing name of an
R2instance’s bucket,<worker>-<capability, kebab>:shop-cartandR2_ARCHIVESgiveshop-cart-archives. R2 bucket names are scoped to the account (not the Worker), so the Worker’s name carries the uniqueness.bynk deployenvironment-qualifies it. - ratelimit_
namespace_ placeholder - P3 (#2342): the placeholder
namespace_idof rate limiterbinding, whichbynk deployreplaces with the id the ledger allocates. Miniflare takes it as it is, sobynk devruns with it. - ratelimits_
needing_ ids - P3 (#2342): the rate limiters whose
namespace_idis still its placeholder, byname, in file order. - retarget_
services - Interop I5 (#1972): point Service Bindings at other Workers, structurally,
by binding: each
[[services]]entry whose bindingtargetsnames gets thatservice.bynk devuses it to bind a foreign Worker to its local stand-in, which runs under a name of its own so that it never answers for the real Worker in wrangler’s shared dev registry. Unchanged text when nothing matches, asmaterialise_kv_namespace_ids. - singleton_
is - Whether
sourceis the one-per-Worker binding ofcapability(#3300, #3478): the kind test for a singleton, whose runtime type and test double differ per capability. - stored_
secret_ entries - #3301: a generated
wrangler.toml’s[[secrets_store_secrets]]entries as(binding, store_id, secret_name), in file order; an entry missing any is skipped. In a freshly generated filestore_idis the store’s name. - vectorize_
index_ entries - A generated
wrangler.toml’s[[vectorize]]entries as(binding, index_name), in file order; an entry missing either is skipped. - vectorize_
index_ name - #3479: the account-facing name of a
Vectorizeinstance’s index,<worker>-<capability>in kebab case:shop-cartandVECTORIZE_DOCSgiveshop-cart-docs. Cloudflare takes a kebab-cased name of at most 64 bytes, so a name longer than that, less room for the environment suffix, keeps its head and ends in a hash of the whole name (the same inputs always give the same name).bynk deployenvironment-qualifies it (shop-cart-docs-staging). - wasm_
rule_ block - #2321: the explicit module rule for a Worker whose adapter closure reaches
an included WebAssembly module:
**/*.wasmis compiled by Wrangler to aWebAssembly.Module(the shim’simport module from "./x.wasm"). Wrangler’s default rules already say this; stating it keeps the dependency visible and stops it changing under us.fallthrough = trueleaves the other default rules in force.
Type Aliases§
- Binding
Kind - A test of a binding’s kind (
|s| matches!(s, BindingSource::Kv)), as the tables pairing each platform-resource kind with what it needs use.