Skip to content
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

remove js payload limit #1823

Merged
merged 50 commits into from
Jan 9, 2023
Merged

remove js payload limit #1823

merged 50 commits into from
Jan 9, 2023

Conversation

djskinner
Copy link
Contributor

@djskinner djskinner commented Sep 29, 2022

Goal

  • Remove the check that prevented attempting delivery of event and session payloads > 1MB
  • For delivery implementations that support retries, ensure that any failed event is not retried if > 1MB

Design

  • Remove code in json-payload that throws for oversized events thus allowing for attempted send
  • Check payload size of failed-to-send events in each delivery method and handle them accordingly: logging and ensuring they are not retried

Changeset

Testing

  • Manual tests
    • Electron: Attempt to send over-sized (breadcrumb metadata) payload and verify log output and no retry
    • Node
    • x-domain-request: Tested on ie8/ie9 via Browserstack
    • xml-http-request: Tested on Firefox, Chrome (latest), IE11 via Browserstack
    • expo: tested with a local expo app force pulling a local version of @bugsnag/core with these changes in and verifying no issues upon the 400 response (though no logging as that only gets added in explicitly mark failed payloads >1MB as not retryable bugsnag-expo#65)
  • e2e test coverage for much of the above

const req = new win.XDomainRequest()
req.onload = function () {
cb(null)
}
req.onerror = function () {
client._logger.error('Event failed to send…\n')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

node does logger.error(Event failed to send…` so I thought maybe the browser delivery methods should too

@github-actions
Copy link

github-actions bot commented Sep 29, 2022

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 43.19 kB 13.21 kB
After 43.43 kB 13.34 kB
± ⚠️ +239 bytes ⚠️ +135 bytes

code coverage diff

<temporarily disabled>

Generated by 🚫 dangerJS against c455ae4

CHANGELOG.md Outdated Show resolved Hide resolved
@djskinner djskinner marked this pull request as ready for review October 4, 2022 09:09
Copy link
Member

@gingerbenw gingerbenw left a comment

Choose a reason for hiding this comment

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

changelog wording seems fine to me, but @gareththackeray might have a better idea

djskinner and others added 2 commits October 7, 2022 03:52
Co-authored-by: Gareth Thackeray <gareth.thackeray@smartbear.com>
@djskinner djskinner force-pushed the plat-8731 branch 10 times, most recently from 77f3f51 to ee08e33 Compare October 14, 2022 09:56
@djskinner djskinner force-pushed the plat-8731 branch 10 times, most recently from cdec715 to 6ba92ad Compare November 30, 2022 17:28
Comment on lines 1 to 15
Feature: Delivery of errors

Scenario: Delivery for an oversized error is not retried
Given I launch an app with configuration:
| bugsnag | default |
And I set the HTTP status code for the next "POST" request to 400
And I click "oversized-notify"
Then I wait to receive an error

# Check that Bugsnag is discarding the event
And I wait to receive 3 logs
Then I discard the oldest log
Then I discard the oldest log
And the log payload field "message" equals "Event oversized (2.00 MB)"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Cawllec this doesn't run because the steps are undefined for electron. Perhaps this is something we can add later as I'm happy the manual testing has shown no issues

@@ -15,13 +15,11 @@ Serialized payload was ${payload.length / 10e5}MB (limit = 1MB)
metadata was removed`
}
payload = jsonStringify(event, null, null, { redactedPaths: EVENT_REDACTION_PATHS, redactedKeys })
if (payload.length > 10e5) throw new Error('payload exceeded 1MB limit')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the change can be summarised as: don't throw here so each delivery mechanism attempts the send. For delivery mechanisms that support retries we explicitly make it not retryable if the payload was above the threshold (regardless of 400 status code or not)

@djskinner djskinner force-pushed the plat-8731 branch 2 times, most recently from 1ac085c to c336d30 Compare December 1, 2022 10:35
@djskinner
Copy link
Contributor Author

@imjoehaines @gingerbenw I've requested a re-review. The implementation hasn't changed since you last looked but there has been some work on the e2e tests so I thought it would be good for some more eyes on it again before we merge

CHANGELOG.md Outdated Show resolved Hide resolved
@djskinner djskinner merged commit aced3db into next Jan 9, 2023
@djskinner djskinner deleted the plat-8731 branch January 9, 2023 16:29
@gingerbenw gingerbenw mentioned this pull request Jan 25, 2023
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.

5 participants