-
Notifications
You must be signed in to change notification settings - Fork 25
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
If Sentry responds with 413 request too large, try to send the exception again without any state #95
base: master
Are you sure you want to change the base?
If Sentry responds with 413 request too large, try to send the exception again without any state #95
Conversation
…ion again without any state
Codecov Report
@@ Coverage Diff @@
## master #95 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 1 1
Lines 26 58 +32
Branches 10 13 +3
=====================================
+ Hits 26 58 +32
Continue to review full report at Codecov.
|
I've updated this PR with the 200kB check, so that we skip the initial request and just send the error without any state. But I decided it would be a good idea to still hande the 413 error and retry the request, because it was only a few extra lines of code. Unfortunately there was no way to access the |
e8ad64f
to
40e00a4
Compare
Unfortunately, zlib compression with pako was a dead end. But I finished some proof-of-concept code to test it out. It was actually very easy to get the code working, and the only issue is that Sentry refuses the They probably just don't support gzip/deflate for browser requests. But it's a bit weird, because most of their backend API clients seem to send error reports with gzip compression. And also, I don't think this will even solve the underlying issue. Even after decompressing the data, they will probably still check to make sure it's under 200KB. I've also posted about this on the Sentry forums. In the end, I've just removed the This might be controversial, but I think it would be great if the default stateTransformer did a quick check for any I might send another PR for this idea, as a proof of concept. |
Opened the PR to remove redux-undo history: #96 Even if you decide not to merge this, hopefully some people can find this and use |
…s over the limit of 200KB
40e00a4
to
e101118
Compare
+1 when is this planned to be merged? |
Related: #42
This change ensures that all exceptions are reported, even if they don't include any state. In my own app, I'm also going to add some logic that removes the redux-undo state and only sends the current state.
Another solution would be to use the pako library to gzip the whole request, then send the data with a
Content-Encoding: gzip
header. Apparently some other Sentry clients do this, and since my state had a ton of repeated data due to the undo history, I was able to compress 220 KB down to 5 KB. I'm going to try this next and see if Sentry will accept the request.Actually, I just realized that it would be much better to just intercept the request before it is sent, and check that the request body length is less than 204800. I think that would be a better idea - We can just do
stringify(opts.data)
in the transport and check the length. I'm just not sure if the "maximum payload size" of 200kB also includes request headers. For my test requests, the headers added 527B. So it might be good to give a few KB of leeway and just set the limit at 200000. And even if we detect the limit and bail out early, I think it's still a good idea to keep the retry logic for the 413 response, because it might change in the future.Anyway, I'm going to keep working on this, but wanted to submit now to get some feedback. Thanks!