Repository navigation
feat(website): publish new media to R2 in the Vercel build - #100
Merged
Merged
Conversation
Every change to the case clips failed its first deployment: the build's delivery check needs the media on the CDN, but uploading them was a manual Wrangler step taken after the push, followed by a redeploy. - The Vercel build now runs `assets:publish` between the build and the check. It asks the `atd-assets` bucket, through R2's S3 API, which content-addressed keys it already holds and uploads only the others; a held key whose size differs fails instead of being overwritten. - Credentials are a bucket-scoped R2 API token's S3 pair in R2_ASSETS_* environment variables. Without them (a fork's preview, a local build) the step skips and the check decides, as before. - Requests are signed with aws4fetch, the client Cloudflare documents for R2. Wrangler cannot use a bucket-scoped token, since its object commands call the REST API, which needs an Admin token.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the manual upload and redeploy that every case-clip change needed (e.g. #97 and #99 both failed their first preview).
Cause
vercel.jsonrunsassets:checkafter the build. It fails the deployment if any media the site references is missing fromassets.atd.best, and that guard is right. But putting the media there was a manualwrangler r2 object putstep from a logged-in machine, which in practice came after the push. Each upload also re-sent all 107 files (34 MiB).Change
build → assets:publish → assets:check.assets:publish(scripts/upload-assets.mjs --bucket atd-assets --if-configured):aws4fetch(MIT, 64 kB, no dependencies), the client Cloudflare documents for R2. It's added to the workspace catalog at 1.0.20.Setup needed (owner)
atd-assetsonly.atd-agent, add sensitive variables for Production and Preview:R2_ASSETS_ACCOUNT_ID,R2_ASSETS_ACCESS_KEY_ID,R2_ASSETS_SECRET_ACCESS_KEY.Until then, builds skip the upload exactly as today.
Verification
pnpm --filter @atd/website lint,oxfmt --checkand a CDN build of the site pass, andassets:checkpasses locally.assets:publishskips with exit 0; a manualassets:uploadfails with "Set R2_ASSETS_… to upload."assets:check --fullre-verifies every byte.🤖 Generated with Claude Code