rudderlabs / rudder-sdk-flutter

Flutter SDK for RudderStack - the Customer Data Platform for Developers. Now supports Android, iOS and Web tracking!
https://www.rudderstack.com
Other
6 stars 24 forks source link

BUG : Can't use session recording on Web environment #151

Closed Kiruel closed 5 months ago

Kiruel commented 5 months ago

Describe the bug Please provide the following information:

  1. I want to use session record from PostHog on a Web environment.

Which platform is the issue occurring on Is the error occurring on:

Expected behavior Should send session record to postHog without any setting (at-least on web env).

To Reproduce Steps to reproduce the behaviour:

  1. Initialise Flutter SDK on web env
  2. Make some events
  3. No session record send to posthog.

Version of the Flutter SDK Please provide the following information:

  1. The version of the Rudder Flutter SDK you are using (e.g., Rudder Flutter SDK v1.0.0)
    • rudder_sdk_flutter: ^2.8.0

SDK initialisation snippet Share the code snippet used for initializing the Flutter SDK.

We use our own dataplaneurl and our own destSDKBaseURL.

  _rudderController = RudderController.instance;
 final RudderConfigBuilder builder = RudderConfigBuilder();
    builder.withDataPlaneUrl('URL');
    builder.withControlPlaneUrl('URL');
    builder.withLogLevel(RudderLogger.NONE);
    builder.withWebConfig(
      WebConfig(
        destSDKBaseURL: 'URL',
      ),
    );
    _rudderController?.initialize(
      dotenv.env['RUDDERSTACK_WRITE_KEY']!,
      config: builder.build(),
    );

Framework version of the SDK

➜  pia_narrative git:(main) ✗ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.7, on macOS 14.0 23A344 darwin-arm64, locale en-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.85.2)
[✓] Network resources

• No issues found!

Check for Correct Usage of writeKey and dataPlaneUrl It work when send simple event. But not session record.

desusai7 commented 5 months ago

Hey @Kiruel,

Were you using posthog through device mode or cloud mode ?

Kiruel commented 5 months ago

We use device mode.

Screenshot 2024-02-01 at 14 19 50
desusai7 commented 5 months ago

Can you please share your website url / your write key to help us understand more about the issue ?

You can DM them through slack as well by joining our community

Kiruel commented 5 months ago

I just DM you on slack thanks.

Kiruel commented 5 months ago

Based on the conversion we have on slack, we find the problem. First Flutter Web is not compatible right now for session record. So I have to change the configuration on Rudderstack dashboard to use source as JS and not Flutter, then change the key to the JS key for Web environment.

Second thing on PostHog I had to add my domain to enable session record: Screenshot 2024-02-01 at 17 38 52

You can find in Settings/Session Replay/Authorized Domains for Replay in PostHog.

Thanks for your time again @desusai7 , have nice day.