Skip to content

Secure mode disables streaming in the React SDK #102

@cdcasey

Description

@cdcasey

Is this a support request?
This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the SDK code. If you're not sure whether the problem you are having is specifically related to the SDK, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going here or by emailing support@launchdarkly.com.

Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.

Describe the bug
When I have secure mode enabled, streaming mode does not appear to work. With secure mode enabled, I have to refresh a the page in my web app before seeing the results of having turned a feature flag on or off. I have even tried adding options: { streaming: true } to the initialization call (which is supposed to be unnecessary with the React SDK), but had no luck.

To reproduce
Create a project in LaunchDarkly and set it to secure mode.

Create a boolean flag.

In the entry point, initialize the app like normal:

(async () => {
    const LDProvider = await asyncWithLDProvider({
        clientSideID: <CLIENT SIDE ID>
    });

    ReactDOM.render(
        <Router>
                <LDProvider>
                    <App />
                </LDProvider>
        </Router>,
        document.getElementById("root")
    );
})();

In the main app, update the the user identity once a user is logged in:

    // user is an object that comes in from the identity provider
    // all its attributes have been confirmed and are present
    useEffect(() => {
        async function updateUserIdentity(hash: string) {
            await ldClient.identify(
                {
                    key: user.id,
                },
                hash
            );
        }

        if (isAuthenticated) {
            const userMetadata = user[metadata];

            if (userMetadata.ldHash) {
                updateUserIdentity(userMetadata.ldHash);
            }
        }
    }, [user, ldClient, isAuthenticated]);

Set some component to display conditionally depending on the presence of the flag. Then in the LaunchDarkly dashboard, toggle the flag.

Expected behavior
I expect to see the component disappear or appear based on how the flag is toggled. Instead, nothing changes until I refresh the page of the web app.

SDK version
2.23.2

Language version, developer tools
React 17.0.2

OS/platform
This behavior has been seen in the latest versions of both Firefox and Chrome.

Additional context
With the same configuration, if I turn off secure mode, the flag behaves as expected. I did try to add options: { streaming: true }, to the initialization step, but that had no effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    waiting for feedbackIndicates LaunchDarkly is waiting for customer feedback before issue is closed due to staleness.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions