Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][FEATURE FLAGS] Feature flag changes value even if "Flag persistence" enabled #1756

Open
Garkavenko opened this issue Feb 21, 2025 · 0 comments

Comments

@Garkavenko
Copy link

Feature Flag Value Changes Unexpectedly After identify Call

Issue Summary

I am experiencing unexpected behavior with feature flags and experiments in PostHog. Even though my feature flag persists across authentication events, its value changes after calling posthog.identify.

Steps to Reproduce

I have created a simple repository to reproduce the issue: posthog-feature-flags-bug-reproduce.

To run the reproduction:

node index.js

The setup is a basic Express server that serves an HTML page. The logic is as follows:

  • Initialize the PostHog instance.
  • Subscribe to onFeatureFlags events.
  • Render all feature flag values on the screen.
  • Provide an "Identify user" button that triggers posthog.identify on click.

Expected Behavior

When opening the site in an incognito window, waiting for the first flag value to render, and then clicking "Identify user," the feature flag should remain consistent across events.

Observed Behavior

Once in approximately 7–10 attempts, the flag value changes between "control" and "test" after calling posthog.identify.

Steps to Catch the Bug

  1. Modify the id and email inside the HTML to be unique.
  2. Open a new incognito session (not just a new tab).
  3. Wait for the first onFeatureFlags event (flag value renders on the screen).
  4. Click on the "Identify user" button.
  5. Observe if the flag value changes.

Screenshots

Before identify Call:
Image
After identify Call:
Image

PostHog Account View:
Image
Image

Additional Information

This inconsistency affects experiment allocation and may lead to unpredictable user experiences. Any insights into why posthog.identify affects the feature flag value would be helpful. Let me know if more details are needed!
Project ID: 23437

@Garkavenko Garkavenko changed the title [BUG][FEATURE FLLAGS] Feature flag changes value even if "Flag persistence" enabled [BUG][FEATURE FLAGS] Feature flag changes value even if "Flag persistence" enabled Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant