Skip to content

makeBrowserOfflineTransport not fully compatible with Replay #11207

Closed
@timfish

Description

@timfish

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:

} 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:

// 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?

Metadata

Metadata

Assignees

Labels

Package: replayIssues related to the Sentry Replay SDK

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions