Skip to content

Wrangler app that generates a log upon uploading a file to an R2 bucket

Notifications You must be signed in to change notification settings

garysassano/wrangler-cloudflare-upload-events-logger

Repository files navigation

wrangler-cloudflare-upload-events-logger

Wrangler app that generates a log upon uploading a file to an R2 bucket.

Prerequisites

  • Cloudflare:
    • Must have set the CLOUDFLARE_API_TOKEN variable in your local environment.
  • pnpm:
  • Wrangler:

Deployment

Create R2 buckets:

npx wrangler r2 bucket create upload-bucket
npx wrangler r2 bucket create log-bucket

Create queue:

npx wrangler queues create event-notification-queue

Create worker:

npx wrangler deploy

Enable R2 event notifications:

npx wrangler r2 bucket notification create upload-bucket --event-type object-create --queue event-notification-queue

Usage

  1. Upload a file to upload-bucket from the Cloudflare dashboard.

  2. After the upload is complete, logs will appear in log-bucket.

Cleanup

npx wrangler delete

Architecture Diagram

Architecture Diagram

Releases

No releases published

Packages

No packages published