Fix bedhost-ui worker: name assets binding ASSETS#276
Merged
Conversation
worker.ts falls back to env.ASSETS.fetch() for non-crawler requests, but the assets block had no binding name, so env.ASSETS was undefined and every deep route 500'd (root worked because index.html is served directly). Adding "binding": "ASSETS" restores SPA routing.
Deploying bedhost-ui with
|
| Latest commit: |
6c84937
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2ecc853a.bedhost.pages.dev |
| Branch Preview URL: | https://fix-assets-binding.bedhost.pages.dev |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the bedhost-ui Cloudflare Worker static assets binding so that the Worker’s env.ASSETS.fetch(request) fallback works for SPA deep routes (preventing HTTP 500s on non-root paths).
Changes:
- Add
"binding": "ASSETS"to theassetsblock inui/wrangler.jsoncsoenv.ASSETSis defined at runtime.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
The
worker.tsentry-point falls back toenv.ASSETS.fetch(request)for normal (non-crawler) requests, butui/wrangler.jsoncdeclared the assets block with nobinding. Soenv.ASSETSwas undefined and every deep route returned HTTP 500 (/worked only because index.html is served directly without invoking the worker).Adding
"binding": "ASSETS"fixes it — verified by deploy:/bedset,/bed,/search,/aboutall now return 200 with SPA fallback. Needed before cutting bedbase.org over to this worker.