Make published R2 images visible in local dev - #46
Open
ianmuchyri wants to merge 1 commit into
Open
Conversation
Add "remote": true to the IMAGES_BUCKET R2 binding in wrangler.jsonc so `wrangler dev` connects to the real "websites-images" bucket instead of an empty local simulator -- images published via publish-image.mjs now render locally without manually seeding local R2 state. Bump the wrangler devDependency 4.115.0 -> 4.120.0: the older version has a bug where a remote R2 binding throws "SyntaxError: Unexpected end of JSON input" instead of proxying to R2, which is what made this look broken in the first place. Document in scripts/README.md that `wrangler dev` (not `wrangler pages dev`) is the correct command -- this repo deploys via plain `wrangler deploy` (Workers + static assets), not Pages, so `pages dev` silently drops the R2 binding entirely. Also gitignore .wrangler/, the local state directory `wrangler dev` creates, matching the equivalent fix in magistrala-docs.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
propeller-docs | de1d598 | Aug 07 2026, 04:46 PM |
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.
Summary
"remote": trueto theIMAGES_BUCKETR2 binding inwrangler.jsoncsowrangler devconnects to the realwebsites-imagesbucket instead of an empty local simulator — images published viapublish-image.mjsnow render locally without manually seeding local R2 state.wranglerdevDependency4.115.0->4.120.0: the older version has a bug where a remote R2 binding throwsSyntaxError: Unexpected end of JSON inputinstead of actually proxying to R2, which is what made this look broken in the first place.scripts/README.md(new "Previewing images locally" section, right after "Publishing an image") thatwrangler dev(notwrangler pages dev) is the correct local preview command — this repo deploys via plainwrangler deploy(Workers + static assets), not Pages, sopages devsilently drops the R2 binding entirely..wranglerto.gitignore(the local state directorywrangler devcreates), matching the equivalent fix in magistrala-docs.This is a follow-up to the equivalent fix already merged in magistrala-docs: absmach/magistrala-docs#171
Context
After publishing an image to R2 for this site, there was no way to preview it locally:
next devhas no concept of the image-proxy Worker (worker/index.ts), andwrangler dev's R2 binding defaulted to an empty local simulator rather than the real bucket. On top of that, the wrangler version this repo had pinned (4.115.0) hits a real bug where a remote R2 binding throws instead of proxying — confirmed fixed at 4.120.0.Test plan
pnpm run build && npx wrangler dev— startup banner showsenv.IMAGES_BUCKET (websites-images) R2 Bucket remote(mode = remote, not local)/) returns 200 (redirects to/docs/propeller/architecture/, which itself returns 200).mdxcontent (e.g./docs/propeller/img/dag/basic-dag.svg,/docs/propeller/img/wasi-nn/proplet.svg,/docs/propeller/img/dag/architecture.svg) through the runningwrangler dev— all returned 200 with correctContent-Type: image/svg+xmlremoteis local-dev-only per the installed wrangler's ownconfig-schema.json— no effect on the deployed Worker./node_modules/.bin/wrangler --versionreports4.120.0afterpnpm install