I was especially referring to this page: https://developers.cloudflare.com/workers/wrangler/configuration/
As the most excruciating example: this first sample at the top of page, when cut and pasted verbatim - did not work and it took many hours of investigating to find out why and how to fix it.
Top-level configuration
name = âmy-workerâ
main = âsrc/index.jsâ
compatibility_date = â2022-07-12â
workers_dev = false
route = { pattern = âexample.org/*
â, zone_name = âexample.org
â }
kv_namespaces = [
{ binding = â<MY_NAMESPACE>â, id = â<KV_ID>â }
]
[env.staging]
name = âmy-worker-stagingâ
route = { pattern = âstaging.example.org/*
â, zone_name = âexample.org
â }
kv_namespaces = [
{ binding = â<MY_NAMESPACE>â, id = â<STAGING_KV_ID>â }
]
There were a few problems, but one I remember clearly was that wrangler complained about kv_namespaces being defined twice (did not recognize the two environments). And then when I simply removed one, wranger publish
worked, but then saved âkv_namespacesâ as a single env variable rather than recognizing that it was supposed to be mounting KV namespaces.
It did not work for me until I changed the format from this:
kv_namespaces = [
{ binding = â<MY_NAMESPACE>â, id = â<STAGING_KV_ID>â }
]
to this:
[[kv_namespaces]]
binding = âxxxâ
id = âyyyâ
preview_id = âzzzâ
And yet, the only format that the durable objects would be understood and mounted was:
[durable_objects]
bindings = [
{ name = âabcâ, class_name = âAbcâ }
]
etc.
There were a few other weird things, but those were the two that I remember the most as far the configuration issues go. My they are my problem in whole or part, but if so it was inordinately difficult for me to discover the correct way to implement it.