Skip to content

DX-3114: keep the storage provider out of error messages - #9

Merged
CahidArda merged 1 commit into
mainfrom
dx-3114-blob-clarify-blob-error-without-exposing-internal-r2
Oct 6, 2026
Merged

CahidArda merged 1 commit into
mainfrom
dx-3114-blob-clarify-blob-error-without-exposing-internal-r2

Conversation

@CahidArda

Copy link
Copy Markdown
Contributor

Summary

BlobError messages named R2 in three places. e.message is meant to be shown to end users (the quickstart renders upload.error.message directly), so a customer's users saw "a 403 from R2 usually means…". This PR words those messages around "storage" instead.

Linear: DX-3114

Changes

Where Before After
src/shared/errors.ts, signature_mismatch hint a 403 from R2 usually means the body length or type differs from the signature the upload did not match what was authorized, usually a different size or content type
src/server/r2.ts, rate_limited R2 rate limited the request storage rate limited the request
src/server/r2.ts, request_failed R2 responded <status> <Code>: <Message> storage responded <status> <Code>

Storage's raw <Message> text no longer goes into e.message, since R2 can name itself there. It is set on e.cause instead, so it is still available for debugging.

Codes, statuses and the 403 → signature_mismatch mapping are unchanged. Only the wording differs.

Tests

  • New unit test in test/unit/server.test.ts: a 403, a 429 and a 400 from storage. It asserts that neither message nor hint mentions R2 or Cloudflare, and that storage's text lands on e.cause. It fails without the fix.
  • bun test test/unit: 352 pass. pnpm typecheck and pnpm lint are clean.

Docs

Matching docs change: upstash/docs#896

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ucc4Vbj1ej2kaLWQth3CRw

The signature_mismatch hint, the rate_limited message and the request_failed
message named R2, and e.message is meant to be shown to end users. Reword them
to say "storage", and move storage's raw <Message> text onto e.cause so it is
still there for debugging.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ucc4Vbj1ej2kaLWQth3CRw
@linear-code

linear-code Bot commented Oct 6, 2026

Copy link
Copy Markdown

DX-3114

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused wording changes preserve existing behavior and have appropriate regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Updates user-facing storage errors to avoid exposing R2 implementation details while preserving diagnostic information in cause.

Changes:

  • Rewords signature, rate-limit, and request-failure messages.
  • Moves raw storage failure text to BlobError.cause.
  • Adds regression coverage for provider-neutral errors.
File Description
src/​shared/​errors.ts Rewords the signature-mismatch hint.
src/​server/​r2.ts Makes storage errors provider-neutral and preserves diagnostic details.
test/​unit/​server.test.ts Verifies messages, hints, status mapping, and error causes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@CahidArda
CahidArda merged commit 01b1050 into main Oct 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants