Skip to content

chore(transport): Handle HTTP 413 response for oversized envelopes#2885

Merged
sl0thentr0py merged 1 commit intomasterfrom
feat/http-413
Mar 5, 2026
Merged

chore(transport): Handle HTTP 413 response for oversized envelopes#2885
sl0thentr0py merged 1 commit intomasterfrom
feat/http-413

Conversation

@sl0thentr0py
Copy link
Member

Description

Handle HTTP 413 (Content Too Large) responses from Relay. Previously, oversized envelopes returned HTTP 400 from Relay. Now that Relay returns 413, the SDK can distinguish size-related rejections from other errors.

Changes:

  • When the transport receives an HTTP 413 response, log a warning: "HTTP 413: Envelope dropped due to exceeded size limit" (with response body if available)
  • Record client reports with reason send_error for each dropped item (so Sentry can track data loss)
  • Do NOT retry on 413 — the data is definitively too large
  • The 413 check comes before the existing 429 rate-limit check in the response handling flow
  • Added SizeExceededError exception class (subclass of ExternalError) for internal flow control
  • Added :send_error to the CLIENT_REPORT_REASONS list

Closes #2844

References

Test plan

  • Added tests for 413 response handling with body present
  • Added tests for 413 response handling with empty body
  • Added tests verifying client reports are recorded with send_error reason
  • Added tests verifying send_envelope does not re-raise the error
  • All existing transport tests continue to pass (65 examples, 0 failures)

🤖 Generated with Claude Code

@sl0thentr0py sl0thentr0py changed the title feat(transport): Handle HTTP 413 response for oversized envelopes chore(transport): Handle HTTP 413 response for oversized envelopes Mar 5, 2026
When Relay returns HTTP 413 (Content Too Large), the SDK now logs a
specific warning message and records client reports with reason
"send_error" for the dropped items. The 413 is not retried since the
data is definitively too large.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sl0thentr0py sl0thentr0py marked this pull request as ready for review March 5, 2026 13:54
@sl0thentr0py
Copy link
Member Author

reviewed and approved from me since this is a claude PR

@sl0thentr0py sl0thentr0py enabled auto-merge (squash) March 5, 2026 14:02
@sl0thentr0py sl0thentr0py requested review from dingsdax and solnic March 5, 2026 16:07
@sl0thentr0py sl0thentr0py merged commit 2c1c8b7 into master Mar 5, 2026
257 of 259 checks passed
@sl0thentr0py sl0thentr0py deleted the feat/http-413 branch March 5, 2026 16:28
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.

SDK Handling HTTP 413 [Ruby]

2 participants