From bf52922643948ec00809769007003a930042e0ab Mon Sep 17 00:00:00 2001 From: owang Date: Tue, 4 Aug 2026 08:02:49 -0500 Subject: [PATCH 01/12] [Workers] Document Workers event subscriptions Add a Workers source section to the Queues event subscriptions schemas page, covering the seven Worker lifecycle events emitted to the Event Hub: deployment.created, deployment.deleted, version.created, version.deleted, worker.created, worker.updated, and worker.deleted. Include notes for behaviour that is easy to misread: - The payload `name` is the Worker name at the time the event fired and can change. The stable identifier is the script tag in `source.id`. - `changed` on worker.updated lists unversioned config fields using snake_case Workers API field names, not the camelCase JSON keys. - deployment.created `versions` is the default traffic split summing to 100. Deployments using cohorts can route to versions not listed. - Delivery is at-least-once and unordered, so deduplicate on the payload `id` and sort on metadata.eventTimestamp. --- .../event-subscriptions/events-schemas.mdx | 4 + .../event-subscriptions/workers-events.mdx | 192 ++++++++++++++++++ 2 files changed, 196 insertions(+) create mode 100644 src/content/partials/queues/event-subscriptions/workers-events.mdx diff --git a/src/content/docs/queues/event-subscriptions/events-schemas.mdx b/src/content/docs/queues/event-subscriptions/events-schemas.mdx index d5fb99894f1..7e8cddd0f9b 100644 --- a/src/content/docs/queues/event-subscriptions/events-schemas.mdx +++ b/src/content/docs/queues/event-subscriptions/events-schemas.mdx @@ -41,6 +41,10 @@ This page provides a comprehensive reference of available event sources and thei +### Workers + + + ### Workers AI diff --git a/src/content/partials/queues/event-subscriptions/workers-events.mdx b/src/content/partials/queues/event-subscriptions/workers-events.mdx new file mode 100644 index 00000000000..e1ece4df79e --- /dev/null +++ b/src/content/partials/queues/event-subscriptions/workers-events.mdx @@ -0,0 +1,192 @@ +The `name` field in each payload is the Worker name at the time the event fired, and that name can change. The stable identifier for a Worker is the script tag in `source.id`. When a Worker is renamed, the `worker.updated` event reports the new name, and the previous name is not included in the event. + +#### `deployment.created` + +Triggered when a deployment is created and rolled out. + +**Example:** + +```json +{ + "type": "cf.workers.script.deployment.created", + "source": { + "type": "workers.script", + "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" + }, + "payload": { + "name": "my-worker", + "id": "bcf48806-b317-4351-9ee7-36e7d557d4de", + "strategy": "percentage", + "versions": [ + { + "versionId": "3f9e2c1a-7b4d-4e8f-9a01-2b3c4d5e6f70", + "percentage": 100 + } + ] + }, + "metadata": { + "accountId": "f9f79265f388666de8122cfb508d7776", + "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f", + "eventSchemaVersion": 1, + "eventTimestamp": "2025-05-01T02:48:57.132Z" + } +} +``` + +The `versions` array describes the default traffic split, and the `percentage` values always sum to 100. The `strategy` field is currently always `percentage`. Deployments that use cohorts can route traffic to versions that do not appear in `versions`. + +#### `deployment.deleted` + +Triggered when a deployment is deleted. + +**Example:** + +```json +{ + "type": "cf.workers.script.deployment.deleted", + "source": { + "type": "workers.script", + "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" + }, + "payload": { + "name": "my-worker", + "id": "bcf48806-b317-4351-9ee7-36e7d557d4de" + }, + "metadata": { + "accountId": "f9f79265f388666de8122cfb508d7776", + "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f", + "eventSchemaVersion": 1, + "eventTimestamp": "2025-05-01T02:48:57.132Z" + } +} +``` + +#### `version.created` + +Triggered when a new version of the Worker is uploaded. + +**Example:** + +```json +{ + "type": "cf.workers.script.version.created", + "source": { + "type": "workers.script", + "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" + }, + "payload": { + "name": "my-worker", + "id": "3f9e2c1a-7b4d-4e8f-9a01-2b3c4d5e6f70" + }, + "metadata": { + "accountId": "f9f79265f388666de8122cfb508d7776", + "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f", + "eventSchemaVersion": 1, + "eventTimestamp": "2025-05-01T02:48:57.132Z" + } +} +``` + +#### `version.deleted` + +Triggered when a version is deleted. + +**Example:** + +```json +{ + "type": "cf.workers.script.version.deleted", + "source": { + "type": "workers.script", + "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" + }, + "payload": { + "name": "my-worker", + "id": "3f9e2c1a-7b4d-4e8f-9a01-2b3c4d5e6f70" + }, + "metadata": { + "accountId": "f9f79265f388666de8122cfb508d7776", + "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f", + "eventSchemaVersion": 1, + "eventTimestamp": "2025-05-01T02:48:57.132Z" + } +} +``` + +#### `worker.created` + +Triggered when a Worker is created. + +**Example:** + +```json +{ + "type": "cf.workers.script.worker.created", + "source": { + "type": "workers.script", + "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" + }, + "payload": { + "name": "my-worker" + }, + "metadata": { + "accountId": "f9f79265f388666de8122cfb508d7776", + "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f", + "eventSchemaVersion": 1, + "eventTimestamp": "2025-05-01T02:48:57.132Z" + } +} +``` + +#### `worker.updated` + +Triggered when a Worker's unversioned configuration changes. + +**Example:** + +```json +{ + "type": "cf.workers.script.worker.updated", + "source": { + "type": "workers.script", + "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" + }, + "payload": { + "name": "my-worker", + "changed": ["logpush", "tags"] + }, + "metadata": { + "accountId": "f9f79265f388666de8122cfb508d7776", + "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f", + "eventSchemaVersion": 1, + "eventTimestamp": "2025-05-01T02:48:57.132Z" + } +} +``` + +The `changed` array lists which unversioned configuration fields changed. The possible values are `name`, `tags`, `subdomain`, `observability`, `logpush`, `tail_consumers`, `preview_defaults`, and `usage_model`. These values are snake_case because they are the literal Workers API field names, unlike the camelCase keys used elsewhere in the event. Values are sorted and de-duplicated. The event does not include the previous or new value of a changed field. + +#### `worker.deleted` + +Triggered when a Worker is deleted. + +**Example:** + +```json +{ + "type": "cf.workers.script.worker.deleted", + "source": { + "type": "workers.script", + "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" + }, + "payload": { + "name": "my-worker" + }, + "metadata": { + "accountId": "f9f79265f388666de8122cfb508d7776", + "eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f", + "eventSchemaVersion": 1, + "eventTimestamp": "2025-05-01T02:48:57.132Z" + } +} +``` From 01cf11c88f34f9f6c4bdebe9bdf6f251edd97dab Mon Sep 17 00:00:00 2001 From: owang Date: Tue, 4 Aug 2026 09:42:51 -0500 Subject: [PATCH 02/12] [Workers] Correct worker.updated changed shape `changed` is an object keyed by the field that changed, not an array of field names, and it publishes before and after values. Each value reports `from` and `to` for scalar fields, `added` and `removed` for set-valued fields such as tags and tail_consumers, and an empty object for preview_defaults, which changes opaquely. The example now matches the emitting service's test fixture exactly. This replaces the earlier claim that values are sorted and de-duplicated and that no before or after values are included, both of which no longer hold. --- .../event-subscriptions/workers-events.mdx | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/content/partials/queues/event-subscriptions/workers-events.mdx b/src/content/partials/queues/event-subscriptions/workers-events.mdx index e1ece4df79e..f65f1b1efce 100644 --- a/src/content/partials/queues/event-subscriptions/workers-events.mdx +++ b/src/content/partials/queues/event-subscriptions/workers-events.mdx @@ -153,7 +153,17 @@ Triggered when a Worker's unversioned configuration changes. }, "payload": { "name": "my-worker", - "changed": ["logpush", "tags"] + "changed": { + "tags": { + "added": ["prod"], + "removed": ["staging"] + }, + "logpush": { + "from": false, + "to": true + }, + "preview_defaults": {} + } }, "metadata": { "accountId": "f9f79265f388666de8122cfb508d7776", @@ -164,7 +174,13 @@ Triggered when a Worker's unversioned configuration changes. } ``` -The `changed` array lists which unversioned configuration fields changed. The possible values are `name`, `tags`, `subdomain`, `observability`, `logpush`, `tail_consumers`, `preview_defaults`, and `usage_model`. These values are snake_case because they are the literal Workers API field names, unlike the camelCase keys used elsewhere in the event. Values are sorted and de-duplicated. The event does not include the previous or new value of a changed field. +The `changed` object is keyed by the unversioned configuration fields that changed, and only fields that changed are present. The possible keys are `name`, `tags`, `subdomain`, `observability`, `logpush`, `tail_consumers`, `preview_defaults`, and `usage_model`. These keys are snake_case because they are the literal Workers API field names, unlike the camelCase keys used elsewhere in the event. + +Each value describes how that field changed: + +- Scalar fields report `from` and `to`. +- Set-valued fields, such as `tags` and `tail_consumers`, report `added` and `removed`. Either key is omitted when it would be empty. If the members stay the same but their order changes, the field reports `from` and `to` instead. +- The `preview_defaults` field reports an empty object, which means the field changed but its values are not published. #### `worker.deleted` From 3184924bc8740045fa41f41ec93ac05a5a2863d0 Mon Sep 17 00:00:00 2001 From: owang Date: Fri, 7 Aug 2026 10:08:33 -0500 Subject: [PATCH 03/12] fix --- .../event-subscriptions/workers-events.mdx | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/content/partials/queues/event-subscriptions/workers-events.mdx b/src/content/partials/queues/event-subscriptions/workers-events.mdx index f65f1b1efce..4a8e1bbc418 100644 --- a/src/content/partials/queues/event-subscriptions/workers-events.mdx +++ b/src/content/partials/queues/event-subscriptions/workers-events.mdx @@ -14,7 +14,7 @@ Triggered when a deployment is created and rolled out. "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" }, "payload": { - "name": "my-worker", + "workerName": "my-worker", "id": "bcf48806-b317-4351-9ee7-36e7d557d4de", "strategy": "percentage", "versions": [ @@ -22,7 +22,12 @@ Triggered when a deployment is created and rolled out. "versionId": "3f9e2c1a-7b4d-4e8f-9a01-2b3c4d5e6f70", "percentage": 100 } - ] + ], + "annotations": { + "workers/message": "Fix redirect handling" + }, + "authorEmail": "developer@example.com", + "createdOn": "2025-05-01T02:48:57Z" }, "metadata": { "accountId": "f9f79265f388666de8122cfb508d7776", @@ -33,7 +38,7 @@ Triggered when a deployment is created and rolled out. } ``` -The `versions` array describes the default traffic split, and the `percentage` values always sum to 100. The `strategy` field is currently always `percentage`. Deployments that use cohorts can route traffic to versions that do not appear in `versions`. +The `versions` array describes the default traffic split, and the `percentage` values always sum to 100. Deployments that use cohorts can route traffic to versions that do not appear in `versions`. #### `deployment.deleted` @@ -162,8 +167,9 @@ Triggered when a Worker's unversioned configuration changes. "from": false, "to": true }, - "preview_defaults": {} - } + "previews_base_config": {} + }, + "updatedOn": "2025-05-01T02:48:57Z" }, "metadata": { "accountId": "f9f79265f388666de8122cfb508d7776", @@ -174,13 +180,15 @@ Triggered when a Worker's unversioned configuration changes. } ``` -The `changed` object is keyed by the unversioned configuration fields that changed, and only fields that changed are present. The possible keys are `name`, `tags`, `subdomain`, `observability`, `logpush`, `tail_consumers`, `preview_defaults`, and `usage_model`. These keys are snake_case because they are the literal Workers API field names, unlike the camelCase keys used elsewhere in the event. +`updatedOn` is an RFC 3339 UTC timestamp recording when the configuration changed. + +The `changed` object is keyed by the unversioned configuration fields that changed, and only fields that changed are present. The possible keys are `name`, `tags`, `subdomain`, `observability`, `logpush`, `tail_consumers`, `previews_base_config`, and `usage_model`. Each value describes how that field changed: - Scalar fields report `from` and `to`. - Set-valued fields, such as `tags` and `tail_consumers`, report `added` and `removed`. Either key is omitted when it would be empty. If the members stay the same but their order changes, the field reports `from` and `to` instead. -- The `preview_defaults` field reports an empty object, which means the field changed but its values are not published. +- The `previews_base_config` field reports an empty object, which means the field changed but its values are not published. This keeps preview secrets out of the event. #### `worker.deleted` From a9934560034e08be2f27c121329b912f6625c664 Mon Sep 17 00:00:00 2001 From: owang Date: Tue, 11 Aug 2026 09:11:44 -0500 Subject: [PATCH 04/12] final updates --- .../partials/queues/event-subscriptions/workers-events.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/content/partials/queues/event-subscriptions/workers-events.mdx b/src/content/partials/queues/event-subscriptions/workers-events.mdx index 4a8e1bbc418..85fe45f76e6 100644 --- a/src/content/partials/queues/event-subscriptions/workers-events.mdx +++ b/src/content/partials/queues/event-subscriptions/workers-events.mdx @@ -1,4 +1,4 @@ -The `name` field in each payload is the Worker name at the time the event fired, and that name can change. The stable identifier for a Worker is the script tag in `source.id`. When a Worker is renamed, the `worker.updated` event reports the new name, and the previous name is not included in the event. +The `name` field in each payload is the Worker name at the time the event fired, and that name can change. The stable identifier for a Worker is the script tag in `source.id`. When a Worker is renamed, the `worker.updated` event reports the new name in `payload.name`, and reports both the previous and new names in `payload.changed.name`. #### `deployment.created` @@ -40,6 +40,8 @@ Triggered when a deployment is created and rolled out. The `versions` array describes the default traffic split, and the `percentage` values always sum to 100. Deployments that use cohorts can route traffic to versions that do not appear in `versions`. +The `annotations` and `authorEmail` fields are omitted when they are empty. + #### `deployment.deleted` Triggered when a deployment is deleted. From 1b6610b977c3a1c13d0214a06a4a8159ca628934 Mon Sep 17 00:00:00 2001 From: owang Date: Wed, 12 Aug 2026 11:54:52 -0500 Subject: [PATCH 05/12] change --- .../queues/event-subscriptions/workers-events.mdx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/content/partials/queues/event-subscriptions/workers-events.mdx b/src/content/partials/queues/event-subscriptions/workers-events.mdx index 85fe45f76e6..fd4deb8b0f6 100644 --- a/src/content/partials/queues/event-subscriptions/workers-events.mdx +++ b/src/content/partials/queues/event-subscriptions/workers-events.mdx @@ -1,5 +1,3 @@ -The `name` field in each payload is the Worker name at the time the event fired, and that name can change. The stable identifier for a Worker is the script tag in `source.id`. When a Worker is renamed, the `worker.updated` event reports the new name in `payload.name`, and reports both the previous and new names in `payload.changed.name`. - #### `deployment.created` Triggered when a deployment is created and rolled out. @@ -24,7 +22,8 @@ Triggered when a deployment is created and rolled out. } ], "annotations": { - "workers/message": "Fix redirect handling" + "workers/message": "Fix redirect handling", + "workers/triggered_by": "deployment" }, "authorEmail": "developer@example.com", "createdOn": "2025-05-01T02:48:57Z" @@ -40,6 +39,8 @@ Triggered when a deployment is created and rolled out. The `versions` array describes the default traffic split, and the `percentage` values always sum to 100. Deployments that use cohorts can route traffic to versions that do not appear in `versions`. +The `annotations` object uses two keys. `workers/message` is the optional deployment message, and `workers/triggered_by` records what caused the deployment. Deployments made through the deployments API always report `"workers/triggered_by": "deployment"`. Deployments recorded by older Workers APIs report the operation that created them, such as `upload`, `rollback`, or `secret`. + The `annotations` and `authorEmail` fields are omitted when they are empty. #### `deployment.deleted` @@ -70,7 +71,7 @@ Triggered when a deployment is deleted. #### `version.created` -Triggered when a new version of the Worker is uploaded. +Triggered when a new version of the Worker is created. Uploading a Worker creates a version, and so does any operation that copies an existing version, such as a rollback or a change to the Worker's secrets. Those operations emit `version.created` without an upload. **Example:** From 388a67d1ea3dbcf189fb4f2db720b675b75611d6 Mon Sep 17 00:00:00 2001 From: owang-cloud Date: Wed, 12 Aug 2026 16:49:32 -0500 Subject: [PATCH 06/12] Update src/content/partials/queues/event-subscriptions/workers-events.mdx Co-authored-by: Greg Brimble --- .../partials/queues/event-subscriptions/workers-events.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/partials/queues/event-subscriptions/workers-events.mdx b/src/content/partials/queues/event-subscriptions/workers-events.mdx index fd4deb8b0f6..cc111344070 100644 --- a/src/content/partials/queues/event-subscriptions/workers-events.mdx +++ b/src/content/partials/queues/event-subscriptions/workers-events.mdx @@ -185,7 +185,7 @@ Triggered when a Worker's unversioned configuration changes. `updatedOn` is an RFC 3339 UTC timestamp recording when the configuration changed. -The `changed` object is keyed by the unversioned configuration fields that changed, and only fields that changed are present. The possible keys are `name`, `tags`, `subdomain`, `observability`, `logpush`, `tail_consumers`, `previews_base_config`, and `usage_model`. +The `changed` object is keyed by the unversioned configuration fields that changed, and only fields that changed are present. The possible keys are `name`, `tags`, `subdomain`, `observability`, `logpush`, `tail_consumers`, and `usage_model`. Each value describes how that field changed: From ec53c9ebbd6871f0f13c98f15f34667eed539816 Mon Sep 17 00:00:00 2001 From: owang-cloud Date: Wed, 12 Aug 2026 16:49:43 -0500 Subject: [PATCH 07/12] Update src/content/partials/queues/event-subscriptions/workers-events.mdx Co-authored-by: Greg Brimble --- .../partials/queues/event-subscriptions/workers-events.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/content/partials/queues/event-subscriptions/workers-events.mdx b/src/content/partials/queues/event-subscriptions/workers-events.mdx index cc111344070..170f973cf96 100644 --- a/src/content/partials/queues/event-subscriptions/workers-events.mdx +++ b/src/content/partials/queues/event-subscriptions/workers-events.mdx @@ -191,7 +191,6 @@ Each value describes how that field changed: - Scalar fields report `from` and `to`. - Set-valued fields, such as `tags` and `tail_consumers`, report `added` and `removed`. Either key is omitted when it would be empty. If the members stay the same but their order changes, the field reports `from` and `to` instead. -- The `previews_base_config` field reports an empty object, which means the field changed but its values are not published. This keeps preview secrets out of the event. #### `worker.deleted` From 296a1ded578e7ef7b7ab3f29fd47e7de0e6c9146 Mon Sep 17 00:00:00 2001 From: owang-cloud Date: Wed, 12 Aug 2026 16:49:55 -0500 Subject: [PATCH 08/12] Update src/content/partials/queues/event-subscriptions/workers-events.mdx Co-authored-by: Greg Brimble --- .../partials/queues/event-subscriptions/workers-events.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/content/partials/queues/event-subscriptions/workers-events.mdx b/src/content/partials/queues/event-subscriptions/workers-events.mdx index 170f973cf96..c4ae72f1771 100644 --- a/src/content/partials/queues/event-subscriptions/workers-events.mdx +++ b/src/content/partials/queues/event-subscriptions/workers-events.mdx @@ -169,8 +169,7 @@ Triggered when a Worker's unversioned configuration changes. "logpush": { "from": false, "to": true - }, - "previews_base_config": {} + } }, "updatedOn": "2025-05-01T02:48:57Z" }, From 23803c2f064074b8e8e54dabdd6a1f805ed5cae0 Mon Sep 17 00:00:00 2001 From: owang-cloud Date: Wed, 12 Aug 2026 16:50:21 -0500 Subject: [PATCH 09/12] Update src/content/partials/queues/event-subscriptions/workers-events.mdx Co-authored-by: Greg Brimble --- .../partials/queues/event-subscriptions/workers-events.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/partials/queues/event-subscriptions/workers-events.mdx b/src/content/partials/queues/event-subscriptions/workers-events.mdx index c4ae72f1771..f667481f9fb 100644 --- a/src/content/partials/queues/event-subscriptions/workers-events.mdx +++ b/src/content/partials/queues/event-subscriptions/workers-events.mdx @@ -71,7 +71,7 @@ Triggered when a deployment is deleted. #### `version.created` -Triggered when a new version of the Worker is created. Uploading a Worker creates a version, and so does any operation that copies an existing version, such as a rollback or a change to the Worker's secrets. Those operations emit `version.created` without an upload. +Triggered when a new version of the Worker is created. **Example:** From 054b2b66311675a7b10cbb8d497663e45f4984ad Mon Sep 17 00:00:00 2001 From: owang-cloud Date: Wed, 12 Aug 2026 16:50:44 -0500 Subject: [PATCH 10/12] Update src/content/partials/queues/event-subscriptions/workers-events.mdx Co-authored-by: Greg Brimble --- .../partials/queues/event-subscriptions/workers-events.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/partials/queues/event-subscriptions/workers-events.mdx b/src/content/partials/queues/event-subscriptions/workers-events.mdx index f667481f9fb..3642fbdf2e8 100644 --- a/src/content/partials/queues/event-subscriptions/workers-events.mdx +++ b/src/content/partials/queues/event-subscriptions/workers-events.mdx @@ -37,7 +37,7 @@ Triggered when a deployment is created and rolled out. } ``` -The `versions` array describes the default traffic split, and the `percentage` values always sum to 100. Deployments that use cohorts can route traffic to versions that do not appear in `versions`. +The `versions` array describes the default traffic split, and the `percentage` values always sum to 100. The `annotations` object uses two keys. `workers/message` is the optional deployment message, and `workers/triggered_by` records what caused the deployment. Deployments made through the deployments API always report `"workers/triggered_by": "deployment"`. Deployments recorded by older Workers APIs report the operation that created them, such as `upload`, `rollback`, or `secret`. From 6524cd444c0aa9965ea90f3f8df08ee4c04a47ab Mon Sep 17 00:00:00 2001 From: owang-cloud Date: Wed, 12 Aug 2026 16:50:54 -0500 Subject: [PATCH 11/12] Update src/content/partials/queues/event-subscriptions/workers-events.mdx Co-authored-by: Greg Brimble --- .../partials/queues/event-subscriptions/workers-events.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/content/partials/queues/event-subscriptions/workers-events.mdx b/src/content/partials/queues/event-subscriptions/workers-events.mdx index 3642fbdf2e8..51018ee2718 100644 --- a/src/content/partials/queues/event-subscriptions/workers-events.mdx +++ b/src/content/partials/queues/event-subscriptions/workers-events.mdx @@ -39,8 +39,6 @@ Triggered when a deployment is created and rolled out. The `versions` array describes the default traffic split, and the `percentage` values always sum to 100. -The `annotations` object uses two keys. `workers/message` is the optional deployment message, and `workers/triggered_by` records what caused the deployment. Deployments made through the deployments API always report `"workers/triggered_by": "deployment"`. Deployments recorded by older Workers APIs report the operation that created them, such as `upload`, `rollback`, or `secret`. - The `annotations` and `authorEmail` fields are omitted when they are empty. #### `deployment.deleted` From aef3e37f151b1c7a74883f5d4caff91bc79891e1 Mon Sep 17 00:00:00 2001 From: owang Date: Wed, 12 Aug 2026 16:53:08 -0500 Subject: [PATCH 12/12] reordering --- .../event-subscriptions/workers-events.mdx | 124 +++++++++--------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/src/content/partials/queues/event-subscriptions/workers-events.mdx b/src/content/partials/queues/event-subscriptions/workers-events.mdx index 51018ee2718..c6f3d875627 100644 --- a/src/content/partials/queues/event-subscriptions/workers-events.mdx +++ b/src/content/partials/queues/event-subscriptions/workers-events.mdx @@ -1,32 +1,18 @@ -#### `deployment.created` +#### `worker.created` -Triggered when a deployment is created and rolled out. +Triggered when a Worker is created. **Example:** ```json { - "type": "cf.workers.script.deployment.created", + "type": "cf.workers.script.worker.created", "source": { "type": "workers.script", "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" }, "payload": { - "workerName": "my-worker", - "id": "bcf48806-b317-4351-9ee7-36e7d557d4de", - "strategy": "percentage", - "versions": [ - { - "versionId": "3f9e2c1a-7b4d-4e8f-9a01-2b3c4d5e6f70", - "percentage": 100 - } - ], - "annotations": { - "workers/message": "Fix redirect handling", - "workers/triggered_by": "deployment" - }, - "authorEmail": "developer@example.com", - "createdOn": "2025-05-01T02:48:57Z" + "name": "my-worker" }, "metadata": { "accountId": "f9f79265f388666de8122cfb508d7776", @@ -37,26 +23,32 @@ Triggered when a deployment is created and rolled out. } ``` -The `versions` array describes the default traffic split, and the `percentage` values always sum to 100. - -The `annotations` and `authorEmail` fields are omitted when they are empty. - -#### `deployment.deleted` +#### `worker.updated` -Triggered when a deployment is deleted. +Triggered when a Worker's unversioned configuration changes. **Example:** ```json { - "type": "cf.workers.script.deployment.deleted", + "type": "cf.workers.script.worker.updated", "source": { "type": "workers.script", "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" }, "payload": { "name": "my-worker", - "id": "bcf48806-b317-4351-9ee7-36e7d557d4de" + "changed": { + "tags": { + "added": ["prod"], + "removed": ["staging"] + }, + "logpush": { + "from": false, + "to": true + } + }, + "updatedOn": "2025-05-01T02:48:57Z" }, "metadata": { "accountId": "f9f79265f388666de8122cfb508d7776", @@ -67,22 +59,30 @@ Triggered when a deployment is deleted. } ``` -#### `version.created` +`updatedOn` is an RFC 3339 UTC timestamp recording when the configuration changed. -Triggered when a new version of the Worker is created. +The `changed` object is keyed by the unversioned configuration fields that changed, and only fields that changed are present. The possible keys are `name`, `tags`, `subdomain`, `observability`, `logpush`, `tail_consumers`, and `usage_model`. + +Each value describes how that field changed: + +- Scalar fields report `from` and `to`. +- Set-valued fields, such as `tags` and `tail_consumers`, report `added` and `removed`. Either key is omitted when it would be empty. If the members stay the same but their order changes, the field reports `from` and `to` instead. + +#### `worker.deleted` + +Triggered when a Worker is deleted. **Example:** ```json { - "type": "cf.workers.script.version.created", + "type": "cf.workers.script.worker.deleted", "source": { "type": "workers.script", "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" }, "payload": { - "name": "my-worker", - "id": "3f9e2c1a-7b4d-4e8f-9a01-2b3c4d5e6f70" + "name": "my-worker" }, "metadata": { "accountId": "f9f79265f388666de8122cfb508d7776", @@ -93,15 +93,15 @@ Triggered when a new version of the Worker is created. } ``` -#### `version.deleted` +#### `version.created` -Triggered when a version is deleted. +Triggered when a new version of the Worker is created. **Example:** ```json { - "type": "cf.workers.script.version.deleted", + "type": "cf.workers.script.version.created", "source": { "type": "workers.script", "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" @@ -119,21 +119,22 @@ Triggered when a version is deleted. } ``` -#### `worker.created` +#### `version.deleted` -Triggered when a Worker is created. +Triggered when a version is deleted. **Example:** ```json { - "type": "cf.workers.script.worker.created", + "type": "cf.workers.script.version.deleted", "source": { "type": "workers.script", "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" }, "payload": { - "name": "my-worker" + "name": "my-worker", + "id": "3f9e2c1a-7b4d-4e8f-9a01-2b3c4d5e6f70" }, "metadata": { "accountId": "f9f79265f388666de8122cfb508d7776", @@ -144,32 +145,35 @@ Triggered when a Worker is created. } ``` -#### `worker.updated` +#### `deployment.created` -Triggered when a Worker's unversioned configuration changes. +Triggered when a deployment is created and rolled out. **Example:** ```json { - "type": "cf.workers.script.worker.updated", + "type": "cf.workers.script.deployment.created", "source": { "type": "workers.script", "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" }, "payload": { - "name": "my-worker", - "changed": { - "tags": { - "added": ["prod"], - "removed": ["staging"] - }, - "logpush": { - "from": false, - "to": true + "workerName": "my-worker", + "id": "bcf48806-b317-4351-9ee7-36e7d557d4de", + "strategy": "percentage", + "versions": [ + { + "versionId": "3f9e2c1a-7b4d-4e8f-9a01-2b3c4d5e6f70", + "percentage": 100 } + ], + "annotations": { + "workers/message": "Fix redirect handling", + "workers/triggered_by": "deployment" }, - "updatedOn": "2025-05-01T02:48:57Z" + "authorEmail": "developer@example.com", + "createdOn": "2025-05-01T02:48:57Z" }, "metadata": { "accountId": "f9f79265f388666de8122cfb508d7776", @@ -180,30 +184,26 @@ Triggered when a Worker's unversioned configuration changes. } ``` -`updatedOn` is an RFC 3339 UTC timestamp recording when the configuration changed. - -The `changed` object is keyed by the unversioned configuration fields that changed, and only fields that changed are present. The possible keys are `name`, `tags`, `subdomain`, `observability`, `logpush`, `tail_consumers`, and `usage_model`. - -Each value describes how that field changed: +The `versions` array describes the default traffic split, and the `percentage` values always sum to 100. -- Scalar fields report `from` and `to`. -- Set-valued fields, such as `tags` and `tail_consumers`, report `added` and `removed`. Either key is omitted when it would be empty. If the members stay the same but their order changes, the field reports `from` and `to` instead. +The `annotations` and `authorEmail` fields are omitted when they are empty. -#### `worker.deleted` +#### `deployment.deleted` -Triggered when a Worker is deleted. +Triggered when a deployment is deleted. **Example:** ```json { - "type": "cf.workers.script.worker.deleted", + "type": "cf.workers.script.deployment.deleted", "source": { "type": "workers.script", "id": "9a7c3f21b45e4d8a9c0f1e2d3b4a5c6d" }, "payload": { - "name": "my-worker" + "name": "my-worker", + "id": "bcf48806-b317-4351-9ee7-36e7d557d4de" }, "metadata": { "accountId": "f9f79265f388666de8122cfb508d7776",