-
-
Notifications
You must be signed in to change notification settings - Fork 357
SDK handling HTTP 413 #5586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
SDK handling HTTP 413 #5586
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -555,7 +555,9 @@ - (void)stopObserving | |
| [PrivateSentrySDKOnly captureEnvelope:envelope]; | ||
| } | ||
| #endif | ||
| resolve(@YES); | ||
|
|
||
| // TODO(alwx): Capture transport response from sentry-cocoa when available | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The iOS implementation may arrive soon in a next Cocoa 9.x.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| resolve(@ {}); | ||
| } | ||
|
|
||
| RCT_EXPORT_METHOD( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -218,7 +218,26 @@ export const NATIVE: SentryNativeWrapper = { | |
| envelopeBytes = newBytes; | ||
| } | ||
|
|
||
| await RNSentry.captureEnvelope(base64StringFromByteArray(envelopeBytes), { hardCrashed }); | ||
| const response = await RNSentry.captureEnvelope(base64StringFromByteArray(envelopeBytes), { hardCrashed }); | ||
|
|
||
| if (response?.status) { | ||
| const statusCode = parseInt(response.status, 10); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| // Handle HTTP 413 - Content Too Large | ||
| if (statusCode === 413) { | ||
| debug.error( | ||
| 'Failed to send event to Sentry: HTTP 413 - Envelope exceeds size limit.\n' + | ||
| 'The event was rejected because the envelope size exceeds the maximum allowed size.\n' + | ||
| 'Consider reducing the size of breadcrumbs, context data, or attachments.', | ||
| ); | ||
| } | ||
| // Log other error status codes | ||
| else if (statusCode >= 400) { | ||
| debug.error( | ||
| `Failed to send event to Sentry: HTTP ${statusCode}${response.message ? ` - ${response.message}` : ''}`, | ||
| ); | ||
| } | ||
| } | ||
| }, | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could be wrong, but I think the flush/transport is async so the http error will not be triggered here.