Skip to content

Storage events

Storage can publish object lifecycle events to an organization queue. A rule is attached to a bucket and names the destination queue, event types, and optional key prefix or suffix filters. Rules apply consistently to S3 requests, Worker storage bindings, and console/API uploads.

Events are recorded in the storage catalog transaction that commits the object mutation. Delivery is at least once through the normal queue service, with a stable event message id so consumers can deduplicate. Failed delivery remains in the durable outbox and is retried by the storage shard; delivery and retry activity is visible in queue telemetry.

Create and inspect rules with the same Wrangler commands used for R2 event notifications:

npx wrangler r2 bucket notification create photos \
  --event-type object-create \
  --queue photo-processing \
  --prefix originals/

npx wrangler r2 bucket notification list photos

Consumers receive the standard event body with account, action, bucket, object, and eventTime fields. Supported actions are PutObject, CopyObject, CompleteMultipartUpload, and DeleteObject.

Keep generated derivatives outside the source prefix (for example, thumbnails/) so a processor cannot trigger itself. Consumers should remain idempotent and use the queue message id when writing derived state.

The storage-events example as a small end-to-end consumer. It writes a marker under processed/ for each new object under originals/, demonstrating the prefix boundary that prevents generated objects from re-triggering the same rule.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close