Skip to main content

Module wrangler

Module wrangler 

Source
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§

ClassTombstones
State-migrations S3 (#2248): one context’s agent class renames ((old, new)) and removals, as exports tombstones.

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.toml that states what [[containers]] does not: each container’s capability, @build directory and @instanceType, which bynk deploy plans and checks from.
CONTAINERS_MANIFEST_VERSION
The version of CONTAINERS_MANIFEST’s layout.
CONTAINERS_UNAVAILABLE_VAR
#3477 (slice C3): the wrangler dev --var that tells a generated container class its containers are off (bynk dev without Docker), so a call faults naming Docker. The runtime’s own copy is CONTAINERS_UNAVAILABLE_VAR (container.ts); xtask/tests/env_protocol.rs keeps the two equal (#4003). The wrangler dev --var that tells a generated container class its containers are off (bynk dev without Docker).
D1_MIGRATIONS_DIR
P4b (#2608): the directory beside a Worker’s wrangler.toml holding its D1 databases’ migrations, one subdirectory per database, as the project’s own migrations/ 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 with emitter::workers (the Env field name + deps. __eventsDispatch call it drives) and emitter::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 dev binds 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.toml that says which of its [[hyperdrive]] bindings are MySQL, and each one’s @tls mode. wrangler.toml’s stanza names neither (a Hyperdrive config’s database kind and TLS mode are the config’s, not the binding’s), and bynk deploy needs both to make the config. It is written only for a Worker with a MySql instance, so a Postgres-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 for bynk 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, one env.KV field.
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.toml that states each [[vectorize]] binding’s index configuration. wrangler.toml’s stanza names only the index; its dimensions, metric and metadata indexes are what bynk deploy creates it with and checks it against, and Cloudflare cannot change them afterwards. Written only for a Worker with a Vectorize instance, 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 doctor warns about a wrangler below it, and bynk dev prints the same warning before serving.

Functions§

analytics_dataset_name
P3b (#2582): the account-facing name of an Analytics instance’s dataset, <worker>_<capability> in snake case: shop-cart and ANALYTICS_SIGNUPS give shop_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 deploy environment-qualifies it (shop_cart_signups_staging).
asset_headers
#1883, slice 1b: the _headers file written into a Worker’s assets directory beside its files. Every served path carries its content hash, so a file under bynk_check::assets::SERVED_PREFIX never changes and may be cached for a year. Without it the platform’s default is max-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. directory is 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.toml for bynk dev. A Vectorize has no local simulation, so each [[vectorize]] entry whose binding is in dev is pointed at that index of the developer’s own with remote = 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. dev and declared are keyed by binding. The text is unchanged when there is no [[vectorize]].
compatibility_flags
#1890: the flags a Worker’s wrangler.toml carries, and the duplicates dropped on the way. DEFAULT_COMPATIBILITY_FLAGS come first, then extra (the manifest’s list) in order. A name already present, whether a default or earlier in extra, 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_id of D1 binding binding, which bynk deploy replaces with the id it records in the ledger.
d1_database_name
P4a (#2602): the account-facing name of a D1 instance’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 a D1 instance’s database, <worker>-<capability, kebab>: shop-cart and D1_ORDERS give shop-cart-orders. D1 database names are scoped to the account, as R2 bucket names are. bynk deploy environment-qualifies it.
dataset_var_name
#3513 B: the [vars] entry that carries an Analytics binding’s dataset name to the Worker (ANALYTICS_SIGNUPS gives BYNK_DATASET_ANALYTICS_SIGNUPS).
drop_mtls_certificates
#3513 A: text without the [[mtls_certificates]] entries bound as bindings. bynk dev drops a certificate no deploy has linked from its development copy: marked remote = true with 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 an EdgeCache instance. Cloudflare then answers a GET or HEAD from 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 sends no-store on every response but a @cache route’s 2xx (workers_entry). A Worker without an instance gets no stanza.
emit_containers_manifest
#3477 (slice C2): CONTAINERS_MANIFEST for a Worker’s bindings, or None when it has no container. instance_type is null when the declaration gives none, which the platform runs as lite.
emit_hyperdrive_manifest
The bynk-hyperdrive.json of a Worker with bindings, or None when it has no MySql instance. The tls field is the @tls mode as the source wrote it (required when it wrote none).
emit_vectorize_manifest
The bynk-vectorize.json of a Worker with bindings, or None when it has no Vectorize instance.
emit_wrangler_toml
P6.x cutover slice 2 (#1191, narrowed from #1187): crons/queues arrive pre-collected, sorted and deduped by the caller (project.rs’s own emit_wrangler_toml call site) rather than being walked here off table.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 removed wrangler.rs from the ast_importers probe outright — no bynk_model equivalent 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.ts re-exports (BynkInspectRegistry) as __BYNK_INSPECT_REGISTRY, and declares its class, SQLite-backed like every other. Only ever applied to the development copy: the config bynk deploy reads 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 dev serves, where each [[ai_search]] entry also carries remote = true: AI Search has no local simulation, so wrangler proxies the binding to the deployed instance. Only ever applied to the development copy; the config bynk deploy reads never carries it. Unchanged text when there is no such entry.
enable_remote_analytics_sql
#3513 B: the config bynk dev serves, where the [analytics] table (the Analytics SQL binding) also carries remote = 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 dev serves, where each [[mtls_certificates]] entry also carries remote = true: there is no local simulation of an mTLS binding, so wrangler runs it on Cloudflare. Only ever applied to the development copy; the config bynk deploy reads 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 dev adds 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 file id is the placeholder.
hyperdrive_id_placeholder
Hyperdrive H1 (#3318): the placeholder id of Hyperdrive binding binding, which bynk deploy replaces with the id of its Hyperdrive config.
kv_bindings_needing_ids
The bindings of a generated wrangler.toml’s [[kv_namespaces]] entries whose id is still that binding’s deploy-time placeholder (kv_id_placeholder), in file order: what materialise_kv_namespace_ids would patch. Exposed so a caller can learn which ids it needs before doing the (possibly fallible) work of finding them, as bynk dev --remote does 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 for binding carries until bynk deploy materialises it: KV_NAMESPACE_ID_PLACEHOLDER for the bare KV, kv_instance_id_placeholder for 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-cart and KV_SESSIONS give shop-cart-sessions, KV_PRICE_CACHE gives shop-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 deploy environment-qualifies it.
materialise_adopted_container_images
#3477 (slice C2): text with each adopted container image named in the [containers.images.<capability>] entry of environment (the top level for default, else [env.<name>]): the entry’s dockerfile, build_context and build_vars go, and image takes the digest-pinned reference, so wrangler builds nothing for it. images maps 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 binding databases lists gets that (database_name, database_id). Unchanged text when nothing differs, as materialise_r2_bucket_names.
materialise_hyperdrive_ids
Hyperdrive H2 (#3319): point [[hyperdrive]] entries at their configs, structurally, by binding: each entry whose binding ids lists gets that id. Unchanged text when nothing differs, as materialise_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 in ids, and whose id is currently exactly that binding’s placeholder (kv_id_placeholder), gets the id; the decor around the value (the # set at deploy time note) 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 binding names lists gets that bucket_name. The generated name is the unqualified derived one (r2_bucket_name); an environment qualifies it. Unchanged text when nothing differs, as materialise_kv_namespace_ids.
materialise_ratelimit_namespace_ids
P3 (#2342): write each rate limiter’s allocated namespace_id over its placeholder, structurally, by name, leaving its simple = { … } and comment as they are. Unchanged text when nothing matches, as materialise_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 indexes bynk.toml adopts, 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, as materialise_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 R2 instance’s bucket, <worker>-<capability, kebab>: shop-cart and R2_ARCHIVES give shop-cart-archives. R2 bucket names are scoped to the account (not the Worker), so the Worker’s name carries the uniqueness. bynk deploy environment-qualifies it.
ratelimit_namespace_placeholder
P3 (#2342): the placeholder namespace_id of rate limiter binding, which bynk deploy replaces with the id the ledger allocates. Miniflare takes it as it is, so bynk dev runs with it.
ratelimits_needing_ids
P3 (#2342): the rate limiters whose namespace_id is still its placeholder, by name, in file order.
retarget_services
Interop I5 (#1972): point Service Bindings at other Workers, structurally, by binding: each [[services]] entry whose binding targets names gets that service. bynk dev uses 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, as materialise_kv_namespace_ids.
singleton_is
Whether source is the one-per-Worker binding of capability (#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 file store_id is 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 Vectorize instance’s index, <worker>-<capability> in kebab case: shop-cart and VECTORIZE_DOCS give shop-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 deploy environment-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: **/*.wasm is compiled by Wrangler to a WebAssembly.Module (the shim’s import module from "./x.wasm"). Wrangler’s default rules already say this; stating it keeps the dependency visible and stops it changing under us. fallthrough = true leaves the other default rules in force.

Type Aliases§

BindingKind
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.