Skip to main content

Cloudflare Edge (R2 ops)

What this is: Sibling repo cloudflare-edge — @underwood/cloudflare-edge, a Wrangler CLI toolkit for the mappymaps R2 bucket. There is no Worker in this tree; public map packs are objects behind the custom domain https://maps.short.army. Production uploads for packs ≥ 2 GiB run in GitHub Actions (mappy-public / mappy-internal publish workflows), not from local machines.

Cross-link: Mappy Maps CDN (catalog + when packUrl points at R2).

Package scripts​

File: cloudflare-edge/package.json

ScriptPurpose
whoamiwrangler whoami — account verification
r2:listwrangler r2 bucket list
r2:createwrangler r2 bucket create mappymaps (bootstrap)

Dev dependency: wrangler ^4.14.0 (operators use pnpm exec wrangler for commands beyond the npm scripts).

Bucket config​

  • Wrangler stub: cloudflare-edge/buckets/mappymaps/wrangler.jsonc — bucket name mappymaps, compatibility_date 2025-03-01, Cloudflare account binding (no routes).
  • Operator doc: cloudflare-edge/buckets/mappymaps/README.md — MAPPY_OFFICIAL_R2_PUBLIC_BASE, custom domain attach (wrangler r2 bucket domain add), dev-url disable, large-object object put examples.
  • Key prefix: official-maps/{worldId}.mappymap

CI secrets (mappy repos)​

From cloudflare-edge/README.md — GitHub secrets on mappy publish workflows:

SecretRole
CLOUDFLARE_ACCOUNT_IDCloudflare account
MAPPY_OFFICIAL_R2_PUBLIC_BASEPublic base (no trailing slash); canonical https://maps.short.army
MAPPY_R2_ACCESS_KEY_ID / MAPPY_R2_SECRET_ACCESS_KEYS3-compatible R2 token for multipart upload

After upload, CI verifies S3 HeadObject and anonymous HTTP HEAD on the public URL (200 + matching Content-Length). Catalog packUrl is updated in official-maps-index; clients read catalog.json only (no Mappy app release required for URL changes).

Local use (debug only)​

cd cloudflare-edge
pnpm install --ignore-workspace
pnpm exec wrangler whoami
pnpm exec wrangler r2 bucket list

Do not use local upload for production signed packs; signing secrets live in CI.

Failure modes​

SymptomCheck
CI HEAD 401/403 on pack URLMAPPY_OFFICIAL_R2_PUBLIC_BASE still pointing at disabled *.r2.dev
Wrangler put fails on huge fileUse S3 multipart in CI; single object put capped (~300 MiB CLI guidance)
Wrong pack in clientcatalog.json packUrl vs object key under official-maps/

Sources (audited): cloudflare-edge/package.json, cloudflare-edge/README.md, cloudflare-edge/buckets/mappymaps/wrangler.jsonc, cloudflare-edge/buckets/mappymaps/README.md