launchdarkly / react-client-sdk

LaunchDarkly Client-side SDK for React.js
Other
86 stars 70 forks source link

LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. #320

Open ImLunaHey opened 1 month ago

ImLunaHey commented 1 month ago

Is this a support request? no

Describe the bug LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. warnings are logged when passing in manual flags.

To reproduce

const flags = {
    aFlag: true
};
export const FeatureFlagProvider = ({ children }: { children: React.ReactNode }) => (
  <LDProvider
    clientSideID={launchDarklyClientId}
    deferInitialization={!launchDarklyClientId}
    options={{
      bootstrap: flags,
    }}
  >
    <OrgIDIdentifier>{children}</OrgIDIdentifier>
  </LDProvider>
);

Expected behavior No warning/error logged.

Logs

LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly. Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initialize-the-client for instructions on SDK initialization.

SDK version

3.4.0

Language version, developer tools N/A

OS/platform N/A

Additional context N/A

ImLunaHey commented 1 month ago

the node.js instructions suggest that the above is valid. 🤔

https://docs.launchdarkly.com/sdk/features/bootstrapping#nodejs-client-side

kinyoklion commented 1 month ago

Hello @ImLunaHey,

That format will allow the SDK to evaluate flags, but it will also produce warnings. A flat map of flag values is an old format supported in the bootstrap data, but it lacks sufficient information to drive many product features, and will produce this warning. We will not consider removing the warning.

I'll make sure that the documentation is updated to not show the old format.

You can generate bootstrap data using a server-side SDK will will produce a format without such warnings. While manually creating bootstrap data can work, it isn't the intended use of the functionality. The primary use case is generating the bootstrap data using a server SDK, and this warning lets people know if their server SDK is too old to produce the correct data.

If you want to manually create bootstrap, and you don't care about any associated product features that will not work, then you can suppress this in your logs. Typically I would suggest a filter in your logging system, but if you are not using one you can customize the SDK logging.

Thank you, Ryan