Skip to content

feat(infra): provision R2 through trusted Workers Builds - #130

Merged
EagleFox31 merged 5 commits into
mainfrom
feat/r2-via-workers-build
Oct 9, 2026
Merged

EagleFox31 merged 5 commits into
mainfrom
feat/r2-via-workers-build

Conversation

@EagleFox31

Copy link
Copy Markdown
Contributor

Moves the reusable private-media R2 path onto Cloudflare Workers Builds instead of requiring the AppFactory runtime secret to call the R2 REST API directly.

Why:

  • Commerce Factory proved the current AppFactory runtime tokens return Cloudflare 10000 Authentication error on the R2 control endpoint even though the account already has an R2-capable token registered with Workers Builds.
  • the existing registered appfactory-api build token already has R2 access and Cloudflare Builds can use it without revealing or rotating its secret.

What changes:

  • brownfield Worker requests may declare the reviewed r2: { "recipe": "private-media" } capability;
  • AppFactory derives the deterministic <repo>-media bucket name;
  • AppFactory selects a trusted registered R2-capable Workers Builds token by infrastructure-controlled name;
  • Wrangler checks/creates the bucket idempotently before Worker deploy;
  • R2-enabled provisioning waits for the build and returns bucket/build evidence;
  • no new token value, rotation or secret copy is required.

The direct /infrastructure/r2 endpoint remains available for environments where a runtime R2 credential is configured.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
appfactory-api b0aebde Commit Preview URL

Branch Preview URL
Oct 09 2026, 11:50 AM

@EagleFox31
EagleFox31 merged commit 89a2dfe into main Oct 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant