getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.76k stars 1.52k forks source link

Replay fails to start recording when using `start()` #11983

Closed billyvg closed 1 month ago

billyvg commented 1 month ago

Replays will fail to start recording when using start() specifically when manually recording and after the user has been idle for a long period of time. We need to reset the user activity state when we call start(), otherwise the session will be [incorrectly] considered to be idle and unable to send any replay events.

mydea commented 1 month ago

So you mean, a session is ongoing, then you call start() before the session has been invalidated? 🤔

But this is overall not good, in this scenario you should always call replay.isEnabled() and that would also returntrue in this scenario, wouldn't it? In which case you def. should never call start()!

I guess what we could do is check for session expiration in isEnabled() 🤔 that would invalidate the session if it is disabled = but it would just create a new session and not stop it, so you still would not be able to call start() again in this case!

billyvg commented 1 month ago

No this is before a session exists (e.g. manual recording).

billyvg commented 1 month ago

Backport for v7 here