User Worker metadata
You define the Worker’s metadata as part of the multipart upload of user Workers. This metadata defines the Workers’configuration analogue to the wrangler.toml file for regular Workers.
Sample metadata.json
metadata.json{ "main_module": "main.js", "bindings": [ { "type": "service", "name": "<TEST_SERVICE>", "service": "<TEST_SERVICE_NAME>", "environment": "production" }, { "type": "kv_namespace", "name": "<TEST_KV>", "namespace_id": "<KV_ID>" }, { "type": "r2_bucket", "name": "<TEST_R2>", "bucket_name": "<TEST_R2_BUCKET_NAME>" }, { "type": "durable_object_namespace", "name": "<TEST_DURABLE_OBJECT>", "class_name": "<TEST_CLASS>" }, { "type": "d1", "name": "<TEST_D1>", "id": "<TEST_D1_ID>" }, { "type": "analytics_engine", "name": "<TEST_ANALYTICS_ENGINE>", "dataset": "<TEST_DATASET>" }, { "type": "queue", "name": "<TEST_QUEUE>", "queue_name": "<TEST_QUEUE_NAME>" }, { "type": "mtls_certificate", "name": "<TEST_MTLS>", "certificate_id": "<TEST_CERTIFICATE_ID>" }, { "type": "plain_text", "name": "<VAR_NAME>", "text": "<VAR_VALUE>" } ], "tags": ["tag1", "tag2", "tag3"], "migrations": { "new_tag": "init", "new_classes": ["<TEST_CLASS>"] }
}
Attributes
The following attributes are configurable at the top-level.
main_module
string
- The path to the module entry point of the user Worker that will be executed. For example,
main.js
.
- The path to the module entry point of the user Worker that will be executed. For example,
bindings
object
- The bindings for the user Worker to enable interactions with other resources.
Bindings
Analogue to regular Workers, user Workers can also interact with other Cloudflare resources using Bindings. Refer to metadata.json example and the Wrangler configuration documentation for more information.