Skip to content

Session Replay start() method do not work after stop() in some cases #7192

@expcapitaldev

Description

@expcapitaldev

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using? If you use the CDN bundles, please specify the exact bundle (e.g. bundle.tracing.min.js) in your SDK setup.

@sentry/angular

SDK Version

7.37.1

Framework Version

"@sentry/angular": "7.37.1",

Link to Sentry event

No response

SDK Setup

Sentry.init({
dns: myDNS,
// without Replay intergation here, because we do not want create webworker now
...,
replaysSessionSampleRate: 0, // I understand that 0 do not start session, I want to start and init with delay
replaysOnErrorSampleRate: 0,
});
...
private myStart(){
const client: Client | undefined = Sentry.getCurrentHub().getClient();
// enableReplay for example from variable from server
if (client) {
	const currentReplayIntegration: Replay | null = client.getIntegration(Replay);
	if (enableReplay) {
		const options: BrowserOptions = client.getOptions();
		options.replaysSessionSampleRate = 1; // I understand that I need to start with 1
		if (currentReplayIntegration) {
			currentReplayIntegration.flush();
			currentReplayIntegration.stop();
// TODO if I have current session and I do not know now it is is progress or not I can not check it and I want to finish current replay session and start new or start new, I can safety use flush and stop
// in some cases session do not started (I see in network that POST request do not send to sentry server), also it is do not work with timeout for example, for example after 3-5 calling method myStart() you can check that issue
			currentReplayIntegration.start();
		} else {
			client.addIntegration(this.getSentryReplayIntegration());
		}
	} else {
		if (currentReplayIntegration) {
			currentReplayIntegration.flush();
			currentReplayIntegration.stop();
		}
	}
} else {
	// unexpected case, log error here
}
}

Steps to Reproduce

see above

Expected Result

after ReplayIntergation.stop() I can call .start() and new session should be started and send to the server

Actual Result

looks like after stop() new session can not started but I see new Worker created with new ID but POST requests do not send to the server in all

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions