Repository navigation
[No QA] Return 404 when the Cloudflare Worker's previous builds bucket can't be read - #104769
Merged
Merged
Conversation
An R2 error while looking up a file from a previous build made the Worker throw, so the request failed with an exception. It now logs the error and answers like any file no build has, so the tab gets a ChunkLoadError and recovers with a reload.
justinpersaud
marked this pull request as ready for review
October 22, 2026 16:26
justinpersaud
requested review from
AndrewGable and
roryabraham
as code owners
October 22, 2026 16:26
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
AndrewGable
approved these changes
Oct 22, 2026
roryabraham
approved these changes
Oct 22, 2026
Contributor
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Contributor
|
🚧 justinpersaud has triggered a test Expensify/App build. You can view the workflow run here. |
Contributor
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
Contributor
|
🚀 Deployed to staging by https://github.com/justinpersaud in version: 9.5.20-0 🚀
|
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.
Explanation of Change
When a script, style or image the current build doesn't have is requested, the Cloudflare Worker looks it up in the previous builds bucket (R2). If R2 returned an error, for example a transient internal error or a key it rejects, the Worker threw, so the request ended in an exception and a 500. That happened once on staging this week.
Now the Worker logs the error and answers
404, as it does for a file no build has. The tab gets the sameChunkLoadErroras before and recovers with a reload, but the failure shows up as a logged error instead of an exception.Fixed Issues
$ https://github.com/Expensify/Expensify/issues/688126
PROPOSAL:
Tests
web/cloudflare-worker, runnpm testandnpm run typecheck, and verify all 24 tests and the typecheck pass.returns 404 when the previous builds bucket failspasses. It requests a chunk path over R2's 1,024-byte key limit, so the bucket lookup fails, with GET and HEAD.dist/, runnpm run dev, and requesthttp://localhost:8787/<1,100 characters>.bundle.js. Verify it returns404with the security headers, and the terminal logsFailed to read … from the previous builds bucket.Offline tests
None. This only changes the Worker's response when its storage fails.
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
No QA. The failure can't be triggered on demand, and the unit test covers it.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari