Skip to content

FeatureFlag keyFilter only prefixes the first item when using a comma separated list #262

@MitchelKerckhaert

Description

@MitchelKerckhaert

Hi, during our integration of Azure App Configuration using this sdk, we encountered the following bug.

When filtering feature-flags using a keyFilter, the keyFilter is automatically prefixed with '.appconfig.featureflag/' (required to distinguish feature flags from other settings). According to the jsdoc comment for the keyFilter, it is possible to use a comma separated list to select multiple features, provided you spell out the entire feature-flag and don't use a wildcard. But when using a comma separated list, only the first item is prefixed. As a result only the first requested feature-flag is fetched.

EXAMPLE

import { load } from '@azure/app-configuration-provider'
import { DefaultAzureCredential } from '@azure/identity'

const credentials = new DefaultAzureCredential()
const appConfig = await load('URL_TO_APP_CONFIG', credentials, {
  featureFlagOptions: {
    enabled: true,
    selectors: [
      { keyFilter: 'FEATURE_1,FEATURE_2' }
    ],
    refresh: {
      enabled: true,
    },
  },
})

EXPECTED BEHAVIOUR:
Both FEATURE_1 and FEATURE_2 flags are fetched

ACTUAL BEHAVIOUR:
Only FEATURE_1 is fetched

We confirmed this is a result of the automatic prefixing by manually inserting the prefix for all items except the first one. When we do that, all feature-flags are fetched.

Metadata

Metadata

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