-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Problem Statement
My understanding is that Replay relies on the first envelope being received first.
makeBrowserOfflineTransport returns {} when sending of an envelope fails and it's queued which Replay interprets as a successful send:
sentry-javascript/packages/core/src/transports/offline.ts
Lines 135 to 141 in ad9d6ab
| } catch (e) { | |
| if (store && (await shouldQueue(envelope, e as Error, retryDelay))) { | |
| await store.insert(envelope); | |
| flushWithBackOff(); | |
| log('Error sending. Event queued', e as Error); | |
| return {}; | |
| } else { |
Queued envelopes are re-tried after the next successful send and the order they enter the queue is preserved for re-sending.
However, the issue is that if the first envelope fails and is queued, and then the device comes back online, the second envelope will be sent before the first. This means that with an intermittent connection, envelope order is not always preserved.
Currently queuing of replay envelopes is disabled:
sentry-javascript/packages/core/src/transports/offline.ts
Lines 64 to 70 in ad9d6ab
| // We don't queue Session Replay envelopes because they are: | |
| // - Ordered and Replay relies on the response status to know when they're successfully sent. | |
| // - Likely to fill the queue quickly and block other events from being sent. | |
| // We also want to drop client reports because they can be generated when we retry sending events while offline. | |
| if (envelopeContainsItemType(env, ['replay_event', 'replay_recording', 'client_report'])) { | |
| return false; | |
| } |
Solution Brainstorm
This only impacts if there is no connection (or a failure) for only the very first envelope. Not sure of the best solution here. Maybe signal to Replay that the event has been queued?