PostHog / posthog-js-lite

Reimplementation of posthog-js to be as light and modular as possible.
https://posthog.com/docs/libraries
MIT License
65 stars 32 forks source link

RN Session replay plugin isn't starting a new recording after app restart #268

Closed marandaneto closed 3 weeks ago

marandaneto commented 4 weeks ago

Bug description

Context https://github.com/PostHog/posthog/issues/13269#issuecomment-2363950067 This is by design but I understand why it isn't obvious. On RN, the session only rotates if the app is inactive for more than 30 minutes, and the session ID survives app restart which is different than Android and iOS. Changing this would break the behavior of people who rely on this for session durations. So we have a few options here, change the behavior and break compatibility, add a flag to opt in to the new behavior, or else.

How to reproduce

1. 2. 3.

Related sub-libraries

Additional context

Thank you for your bug report – we love squashing them!

marandaneto commented 3 weeks ago

cc @chasem-dev https://github.com/PostHog/posthog-js-lite/releases/tag/posthog-react-native-v3.3.0

chasem-dev commented 3 weeks ago

@marandaneto I just tried this build since it contains both the Identity and sesion changes. When I'm compiling, I'm noticing a strange error preventing my app from bundling. Seems like it's more related to the identity ticket?

image image
[RUN_FASTLANE] ▸ ** ARCHIVE FAILED **
[RUN_FASTLANE] ▸ The following build commands failed:
[RUN_FASTLANE] ▸        SwiftEmitModule normal arm64 Emitting\ module\ for\ posthog_react_native_session_replay (in target 'posthog-react-native-session-replay' from project 'Pods')
[RUN_FASTLANE] ▸ (1 failure)
[RUN_FASTLANE] ** ARCHIVE FAILED **
[RUN_FASTLANE] 
[RUN_FASTLANE] 
[RUN_FASTLANE] The following build commands failed:
[RUN_FASTLANE]  SwiftEmitModule normal arm64 Emitting\ module\ for\ posthog_react_native_session_replay (in target 'posthog-react-native-session-replay' from project 'Pods')
[RUN_FASTLANE] (1 failure)
[RUN_FASTLANE] Exit status: 65
chasem-dev commented 3 weeks ago

I found where it looks like you exposed the variable: https://github.com/PostHog/posthog-ios/commit/501cc8e48991747391240475e9c8cc341e995b08

It seems like the version bump maybe wasn't picked up in a release? https://github.com/PostHog/posthog-ios/commit/333ca7fa6d5072b1fa12f93226c2e8ea153f3b45

Which library uses the posthog-ios dependency?

marandaneto commented 3 weeks ago

@chasem-dev have you upgraded your pods? Try to clean and install your pods, the session replay plugin uses the iOS SDK

chasem-dev commented 3 weeks ago

@marandaneto That worked! I ran cd ios and then did pod update. Testing things out now. Sorry for the false alarm! Thanks for the help