Repository navigation
fix: use fresh Request in serveWithAssets to avoid body-reuse crash - #68
Merged
Merged
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3902577e46
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Brooooooklyn
force-pushed
the
fix/serveWithAssets-fresh-request
branch
from
April 2, 2026 14:06
3902577 to
ff35fef
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
After app.fetch() processes a request, the original Request object may have its body marked as "disturbed". Passing it to env.ASSETS.fetch() then throws "Cannot reconstruct a Request with a used body." Create a new Request preserving url, method, and headers instead of reusing the original. Headers (including If-None-Match / If-Modified-Since for conditional requests) are not affected by body consumption and are safe to forward, ensuring ASSETS can still return 304 Not Modified. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Brooooooklyn
force-pushed
the
fix/serveWithAssets-fresh-request
branch
from
April 2, 2026 14:24
ff35fef to
24c0938
Compare
cpojer
pushed a commit
that referenced
this pull request
Sep 11, 2026
…sAdminSuspended (#68) Previous tests only verified middleware blocking on /me. Add coverage for /projects to confirm the middleware rejects deleted and admin-suspended users across all protected routes, and allows usage-suspended users through. Add unit tests for isAdminSuspended edge cases (null, usage-limit reason, admin reason, unknown reason). Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.


fix: use fresh Request in serveWithAssets to avoid body-reuse crash
After app.fetch() processes a request, the original Request object may
have its body marked as "disturbed". Passing it to env.ASSETS.fetch()
then throws "Cannot reconstruct a Request with a used body."
Create a new Request from just the URL instead of reusing the original.
The method check already ensures only GET/HEAD reach this path, so a
plain
new Request(url)(defaults to GET) is correct.Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
test: add tests for serveWithAssets body-reuse fix
Verify that:
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
Note
Low Risk
Low risk, narrowly scoped change to the worker asset fallthrough to prevent a runtime crash when the original
Requesthas a disturbed body; behavior is covered by added unit tests.Overview
Fixes
serveWithAssets(generated bycompileWorkerEntry) to callenv.ASSETS.fetch()with a freshRequestbuilt from the original URL/method/headers, avoiding Cloudflare’s "used body" crash afterapp.fetch().Adds unit tests asserting the GET/HEAD guard remains in place and that
ASSETS.fetchno longer receives the originalrequestobject.Written by Cursor Bugbot for commit 24c0938. This will update automatically on new commits. Configure here.