Skip to content

Commit f562be8

Browse files
committed
ref: Remove keepalive:true as a default and document payload size
1 parent 50a5ec7 commit f562be8

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

docs/config.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,15 @@ Those configuration options are documented below:
327327

328328
``fetch()`` init parameters (https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters).
329329

330+
Setting ``keepalive: true`` parameter will allow SDK to send events in ``unload`` and ``beforeunload`` handlers.
331+
However, it'll also restrict the size of a single event to 64kB, per `fetch specification <https://fetch.spec.whatwg.org/#http-network-or-cache-fetch`__ (point 8.5).
332+
330333
Defaults:
331334

332335
.. code-block:: javascript
333336
334337
{
335338
method: 'POST',
336-
keepalive: true,
337339
referrerPolicy: 'origin'
338340
}
339341

docs/usage.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ functions all allow passing additional data to be tagged onto the error.
132132
133133
Raven.wrap({
134134
tags: {git_commit: 'c0deb10c4'}
135-
}, function () { /* ... */ });
135+
}, function () {
136+
// ...
137+
});
136138
137139
// NOTE: Raven.wrap and Raven.context accept options as first argument
138140
@@ -163,7 +165,9 @@ functions all allow passing additional data to be tagged onto the error.
163165
164166
Raven.context({
165167
extra: {planet: {name: 'Earth'}}
166-
}, function () { /* ... */ });
168+
}, function () {
169+
// ...
170+
});
167171
168172
// NOTE: Raven.wrap and Raven.context accept options as first argument
169173
@@ -186,6 +190,10 @@ functions all allow passing additional data to be tagged onto the error.
186190
Raven.setExtraContext(); // Clear all extra data from the context.
187191
Raven.setExtraContext(extra); // Add back the extra data that you want to keep.
188192
193+
**Be aware of maximal payload size** - There are times, when you want to send a whole application state as an extra data.
194+
This can be quite a large object, which can easily weigh more than 200kB, which is currently maximamal payload size of a single event sent to Sentry.
195+
When this happens, you'll get an ``HTTP Error 413 Payload Too Large`` as the server response or (when ``keepalive: true`` is set as ``fetch`` parameter) request will stay in ``pending`` state forever (eg. in Chrome).
196+
189197
.. _raven-js-recording-breadcrumbs:
190198

191199
Recording Breadcrumbs

packages/raven-js/src/raven.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ function Raven() {
9898
};
9999
this._fetchDefaults = {
100100
method: 'POST',
101-
keepalive: true,
102101
// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default
103102
// https://caniuse.com/#feat=referrer-policy
104103
// It doesn't. And it throw exception instead of ignoring this parameter...

packages/raven-js/test/raven.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1870,7 +1870,6 @@ describe('globals', function() {
18701870
assert.deepEqual(window.fetch.lastCall.args, [
18711871
'http://localhost/?a=1&b=2',
18721872
{
1873-
keepalive: true,
18741873
referrerPolicy: supportsReferrerPolicy() ? 'origin' : '',
18751874
method: 'POST',
18761875
body: '{"foo":"bar"}'

0 commit comments

Comments
 (0)