1

I'm doing a PoC for Azure App Configuration. I created a free instance in our Azure env and added a couple of feature flags. The Issue I am having is with the JavaScript SDK when attempting to fetch feature flags from the App Configuration. Here's the snippet of code that I am using. (NOTE: the app is a React app w/ Typescript)

import { AppConfigurationClient } from '@azure/app-configuration';
import { GetConfigurationSettingResponse } from '@azure/app-configuration';

const appConfigClient = new AppConfigurationClient(process.env.REACT_APP_APPCONFIG_CONNECTION_STRING);

const requestFeatureFlags = async (): Promise<GetConfigurationSettingResponse> => {

    const featureFlags = await appConfigClient.getConfigurationSetting({ key: '', label: 'my_feature_flags' });
    console.log(featureFlags);

    return featureFlags;
}

requestFeatureFlags().then((response) => { alert('I am here'); console.log(response) });

In the above I can see the request being made in the browser dev console and response with the feature flags, but the Promise is never returned from the await appConfigClient.getConfigurationSetting({ key: '', label: 'my_feature_flags' }); call. The console log of featureFlags yields this in the browser console -> enter image description here

The alert inside the then() is never fired. So at this point I'm a loss lol. The SDK can be found here -> npm https://www.npmjs.com/package/@azure/app-configuration/v/1.1.0

If anyone else has come across this issue and help would be most appreciated!

Joseph Freeman
  • 1,644
  • 4
  • 24
  • 43
  • Can you try by changing `return featureFlags` to `return featureFlags.value`? This is based on the example here: https://learn.microsoft.com/en-us/javascript/api/overview/azure/app-configuration-readme?view=azure-node-latest#create-and-get-a-setting. – Gaurav Mantri Mar 18 '21 at 15:31
  • That doesn't work either. `getConfigurationSetting()` has a return type of Promise. – Joseph Freeman Mar 18 '21 at 21:11

0 Answers0