Skip to content

fix: log R2 errors on source GET 500s - #307

Merged
kptdobe merged 2 commits into
mainfrom
fix/log-r2-get-500-errors
Jul 23, 2026
Merged

fix: log R2 errors on source GET 500s#307
kptdobe merged 2 commits into
mainfrom
fix/log-r2-get-500-errors

Conversation

@kptdobe

@kptdobe kptdobe commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • getObject's catch block only called console.error when the S3/R2 error had no $metadata.httpStatusCode. Real backend failures (R2 returning a 500 InternalError) do carry one, so the common case fell through silently — Cloudflare Logs showed nothing to diagnose it.
  • Traced from a monitoring alert (>100 errors) that fired on 2026-07-22 19:05–19:15 UTC: ~70 source GET 500s spread across 20+ unrelated orgs, self-resolved in ~10min, with zero log detail to confirm root cause.
  • Now logs whenever status >= 500, matching the existing convention in storage/version/put.js.

Test plan

  • Added regression test in test/storage/object/get.test.js reproducing an R2 500 with httpStatusCode set — confirmed it fails on pre-fix code and passes with the fix
  • npm run lint clean
  • Full test/storage/object/get.test.js + move.test.js suite passing

getObject's catch block only logged when the S3/R2 error carried no
httpStatusCode. Real backend failures (R2 returning a 500 InternalError)
do carry one, so the most common case fell through silently, returning
a bare 500 with nothing in Cloudflare Logs to diagnose it. Log whenever
status >= 500, matching the convention already used in storage/version/put.js.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Keep the original 'Error getting object without httpStatusCode' message
for network/timeout failures, alongside the new 'Error getting object'
message for backend error responses — both now gated on status >= 500.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@kptdobe
kptdobe merged commit db8f824 into main Jul 23, 2026
6 checks passed
@kptdobe
kptdobe deleted the fix/log-r2-get-500-errors branch July 23, 2026 07:58
adobe-bot pushed a commit that referenced this pull request Jul 23, 2026
## [1.13.3](v1.13.2...v1.13.3) (2026-07-23)

### Bug Fixes

* log R2 errors on source GET 500s ([#307](#307)) ([db8f824](db8f824))
@adobe-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.13.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants