Skip to content

Flagsmith client does not behave correctly in MultiProvider setup #1226

Open
@belaczek

Description

@belaczek

Bug Report: MultiProvider Does Not Fallback to Secondary Provider while using FlagsmithClientProvider

Description

When using WebMultiProvider with FirstMatchStrategy, the expected behavior is that if a flag is not defined in the primary provider (FlagsmithClientProvider), the system should fallback to the next provider (ProviderB). However, this does not happen as expected.

Reproduction Steps

  1. Configure WebMultiProvider as follows:
    const multiProvider = new WebMultiProvider(
      [
        {
          provider: new FlagsmithClientProvider(),
        },
        {
          provider: new ProviderB(),
        }
      ],
      new FirstMatchStrategy()
    );
  2. Ensure that:
    • Feature flag "xxx" is not defined in FlagsmithClientProvider.
    • Feature flag "xxx" is defined as true in ProviderB.
  3. Request the flag "xxx" using multiProvider.

Expected Behavior

  • The flag "xxx" should resolve to true, as it is defined in ProviderB.

Actual Behavior

  • The resolved value is always false, even though ProviderB has "xxx" set to true.

Possible Cause

It seems that FirstMatchStrategy only fallback to the second provider when the first one evaluates to ErrorCode.FLAG_NOT_FOUND. However, when FlagsmithClientProvider does not find a flag, it throws TypeMismatchError.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions