Skip to content

Conversation

@alwx
Copy link
Contributor

@alwx alwx commented Jan 27, 2026

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Adds handling for 413 error code.

  • SDK now logs actionable error messages when envelopes are rejected due to size limits
  • Prepared infrastructure to capture HTTP status codes from native transport layer for future enhancements

Fixes #5566

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

@alwx alwx self-assigned this Jan 27, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • SDK handling HTTP 413 by alwx in #5586
  • chore(deps): update JavaScript SDK to v10.37.0 by github-actions in #5589
  • chore(deps): update Bundler Plugins to v4.8.0 by github-actions in #5581
  • feat(tracing): Add sentry-span-attributes prop for custom span attributes by antonis in #5569
  • chore(deps): bump actions/checkout from 6.0.1 to 6.0.2 by dependabot in #5576
  • chore(deps): bump github/codeql-action from 4.31.10 to 4.31.11 by dependabot in #5573
  • chore(deps): bump getsentry/craft from 2.19.0 to 2.20.0 by dependabot in #5575
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.19.0 to 2.20.0 by dependabot in #5574
  • ci(release): Fix changelog-preview permissions by BYK in #5571

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Features

- SDK handling HTTP 413 ([#5586](https://github.com/getsentry/sentry-react-native/pull/5586))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against 7229338

@alwx alwx added the ready-to-merge Triggers the full CI test suite label Jan 27, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 447.02 ms 505.48 ms 58.46 ms
Size 43.75 MiB 48.40 MiB 4.65 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
4604da9+dirty 366.44 ms 398.10 ms 31.66 ms
8ff81c0+dirty 574.58 ms 611.44 ms 36.86 ms
93137d1+dirty 400.15 ms 424.74 ms 24.59 ms
1ef8a04+dirty 415.16 ms 415.22 ms 0.06 ms
a31630c+dirty 408.91 ms 416.80 ms 7.89 ms
11ded16+dirty 317.29 ms 329.15 ms 11.86 ms
180638b+dirty 408.87 ms 432.04 ms 23.17 ms
8e653ac+dirty 360.28 ms 372.04 ms 11.76 ms
6416d6c+dirty 407.30 ms 422.00 ms 14.70 ms
161947d+dirty 393.26 ms 403.00 ms 9.74 ms

App size

Revision Plain With Sentry Diff
4604da9+dirty 17.75 MiB 19.74 MiB 2.00 MiB
8ff81c0+dirty 43.75 MiB 48.05 MiB 4.29 MiB
93137d1+dirty 17.75 MiB 19.70 MiB 1.95 MiB
1ef8a04+dirty 43.75 MiB 48.05 MiB 4.29 MiB
a31630c+dirty 17.75 MiB 19.68 MiB 1.94 MiB
11ded16+dirty 17.75 MiB 19.75 MiB 2.00 MiB
180638b+dirty 43.75 MiB 48.08 MiB 4.33 MiB
8e653ac+dirty 17.75 MiB 19.75 MiB 2.00 MiB
6416d6c+dirty 43.75 MiB 48.05 MiB 4.30 MiB
161947d+dirty 17.75 MiB 19.70 MiB 1.95 MiB

@github-actions
Copy link
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 362.98 ms 370.65 ms 7.67 ms
Size 43.94 MiB 49.22 MiB 5.29 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
8ff81c0+dirty 392.47 ms 431.52 ms 39.05 ms
1ef8a04+dirty 450.73 ms 482.38 ms 31.65 ms
785ffb1+dirty 380.65 ms 451.83 ms 71.18 ms
ba75c7c+dirty 377.92 ms 417.74 ms 39.83 ms
180638b+dirty 434.46 ms 470.90 ms 36.44 ms
8e653ac+dirty 304.49 ms 308.84 ms 4.35 ms
6416d6c+dirty 469.16 ms 508.22 ms 39.06 ms
a2bb688+dirty 371.19 ms 389.18 ms 17.99 ms
59d1977+dirty 366.15 ms 393.21 ms 27.06 ms
a699d13+dirty 441.38 ms 487.27 ms 45.89 ms

App size

Revision Plain With Sentry Diff
8ff81c0+dirty 43.94 MiB 48.87 MiB 4.93 MiB
1ef8a04+dirty 43.94 MiB 48.87 MiB 4.93 MiB
785ffb1+dirty 7.15 MiB 8.42 MiB 1.27 MiB
ba75c7c+dirty 7.15 MiB 8.42 MiB 1.27 MiB
180638b+dirty 43.94 MiB 48.91 MiB 4.97 MiB
8e653ac+dirty 7.15 MiB 8.46 MiB 1.31 MiB
6416d6c+dirty 43.94 MiB 48.88 MiB 4.94 MiB
a2bb688+dirty 7.15 MiB 8.43 MiB 1.28 MiB
59d1977+dirty 43.94 MiB 49.22 MiB 5.29 MiB
a699d13+dirty 43.94 MiB 48.88 MiB 4.94 MiB

CHANGELOG.md Outdated

- Add handling for HTTP 413 (Content Too Large) responses from Relay ([#5566](https://github.com/getsentry/sentry-react-native/issues/5566))
- SDK now logs actionable error messages when envelopes are rejected due to size limits
- Prepared infrastructure to capture HTTP status codes from native transport layer for future enhancements
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think we could skip this from the changelog since it is not a user facing change

Suggested change
- Prepared infrastructure to capture HTTP status codes from native transport layer for future enhancements

#endif
resolve(@YES);

// TODO(alwx): Capture transport response from sentry-cocoa when available
Copy link
Contributor

Choose a reason for hiding this comment

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

The iOS implementation may arrive soon in a next Cocoa 9.x.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

could add it once it's there, shouldn't be too urgent anyway

Copy link
Member

Choose a reason for hiding this comment

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

We released this yesterday with 9.3.0. But the transport doesn't expose the response code. It simply logs an error. Don't these Cocoa SDK logs don't show up in your RN logs? If yes, then all good nothing to do. If not, we need to align on how we can communicate this. This won't be straight forward, because we first store envelopes to disk and then send these async.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1203.87 ms 1210.33 ms 6.46 ms
Size 3.38 MiB 4.60 MiB 1.22 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
6bd9054+dirty 1212.20 ms 1217.89 ms 5.70 ms
d73150f+dirty 1198.44 ms 1210.06 ms 11.62 ms
d081295+dirty 1214.40 ms 1211.27 ms -3.13 ms
d1fd647+dirty 1219.35 ms 1233.18 ms 13.83 ms
ea3e26e+dirty 1229.13 ms 1228.46 ms -0.67 ms
80e4616+dirty 1221.32 ms 1225.64 ms 4.32 ms
955f2eb+dirty 1235.06 ms 1253.88 ms 18.81 ms
5ee3314+dirty 1215.18 ms 1207.64 ms -7.54 ms
70250df+dirty 1214.51 ms 1215.04 ms 0.53 ms
664c66f+dirty 1215.37 ms 1221.30 ms 5.92 ms

App size

Revision Plain With Sentry Diff
6bd9054+dirty 3.41 MiB 4.67 MiB 1.25 MiB
d73150f+dirty 3.38 MiB 4.60 MiB 1.22 MiB
d081295+dirty 3.41 MiB 4.59 MiB 1.18 MiB
d1fd647+dirty 2.63 MiB 3.99 MiB 1.36 MiB
ea3e26e+dirty 3.41 MiB 4.58 MiB 1.17 MiB
80e4616+dirty 3.38 MiB 4.60 MiB 1.22 MiB
955f2eb+dirty 2.63 MiB 3.98 MiB 1.35 MiB
5ee3314+dirty 2.63 MiB 3.99 MiB 1.35 MiB
70250df+dirty 3.44 MiB 4.59 MiB 1.15 MiB
664c66f+dirty 3.38 MiB 4.60 MiB 1.22 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1204.06 ms 1209.60 ms 5.53 ms
Size 3.38 MiB 4.60 MiB 1.22 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
6bd9054+dirty 1207.02 ms 1199.27 ms -7.76 ms
d73150f+dirty 1224.52 ms 1227.17 ms 2.65 ms
d081295+dirty 1205.24 ms 1207.52 ms 2.28 ms
d1fd647+dirty 1218.16 ms 1225.82 ms 7.65 ms
ea3e26e+dirty 1216.61 ms 1214.15 ms -2.47 ms
80e4616+dirty 1206.90 ms 1205.94 ms -0.96 ms
955f2eb+dirty 1225.78 ms 1239.27 ms 13.49 ms
5ee3314+dirty 1234.25 ms 1235.44 ms 1.19 ms
70250df+dirty 1211.96 ms 1222.31 ms 10.35 ms
664c66f+dirty 1195.94 ms 1194.80 ms -1.14 ms

App size

Revision Plain With Sentry Diff
6bd9054+dirty 3.41 MiB 4.67 MiB 1.25 MiB
d73150f+dirty 3.38 MiB 4.60 MiB 1.22 MiB
d081295+dirty 3.41 MiB 4.59 MiB 1.18 MiB
d1fd647+dirty 3.19 MiB 4.56 MiB 1.37 MiB
ea3e26e+dirty 3.41 MiB 4.58 MiB 1.17 MiB
80e4616+dirty 3.38 MiB 4.60 MiB 1.22 MiB
955f2eb+dirty 3.19 MiB 4.55 MiB 1.36 MiB
5ee3314+dirty 3.19 MiB 4.55 MiB 1.37 MiB
70250df+dirty 3.44 MiB 4.59 MiB 1.15 MiB
664c66f+dirty 3.38 MiB 4.60 MiB 1.22 MiB

@antonis
Copy link
Contributor

antonis commented Jan 27, 2026

@sentry review

@alwx alwx requested a review from antonis January 29, 2026 10:59
@alwx
Copy link
Contributor Author

alwx commented Jan 29, 2026

Removed that changelog entry in the last commit

Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

I was thinking that we may not need to ship any code for #5566 (similar to #5390) and just rely on the native SDK implementation (iOS, Android).
We can mark the issue as done once we ship an RN version with that includes both the native implementations. Wdyt @alwx @lucas-zimerman @philipphofmann?

const response = await RNSentry.captureEnvelope(base64StringFromByteArray(envelopeBytes), { hardCrashed });

if (response?.status) {
const statusCode = parseInt(response.status, 10);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you for the PR!, the solution is nice, but I fear just parsing an integer from a string may be flaky when other types of error happen. Would it be possible to return the statusCode as integer and the errormessage on separated parameters on the native side?

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

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDK Handling HTTP 413 [React Native]

5 participants