Flagsmith / Flagsmith/flagsmith-nodejs-client

Feature values always have type string when using local evaluation mode

オープン
#146 コメント 0 件 リアクション 2 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
30
フォーク
26
平均マージ
11分
マージ済み PR(30日)
5

説明

We've started seeing an issue where number values like this one are being returned as type `string` when `enableLocalEvaluation` is set to `true`.
![Screenshot 2024-03-01 at 11 38 49](https://github.com/Flagsmith/flagsmith-nodejs-client/assets/4126778/7d156b87-acee-4ace-8c5f-0bc5e265ec94)

Using this test script I've validated that the local evaluation causes the change in behaviour (thanks Matt for the help 🙌 )

This has been tested on `flagsmith-nodejs` versions `2.5.1` and `3.2.0`

```ts
import Flagsmith from 'flagsmith-nodejs';

async function main(): Promise {
const flagClient = new Flagsmith({
environmentKey: 'ser.key',
enableLocalEvaluation: true,
enableAnalytics: false,
});

const environmentFlags = await flagClient.getEnvironmentFlags();
const flag = environmentFlags.getFlag('daisy.settlements.timeout');
console.log(`flagClient.apiUrl=${flagClient.apiUrl}`);
console.log(`flagClient.enableLocalEvaluation=${flagClient.enableLocalEvaluation}`);
console.log(JSON.stringify(flag));
console.log(`typeof flag.value=${typeof flag.value}`);

await flagClient.close();
}

void main();
```

`enableLocalEvaluation=true`
```
flagClient.apiUrl=https://edge.api.flagsmith.com/api/v1/
flagClient.enableLocalEvaluation=true
{"value":"60000","enabled":true,"isDefault":false,"featureId":62178,"featureName":"daisy.settlements.timeout"}
typeof flag.value=string
```

`enableLocalEvaluation=false`
```
flagClient.apiUrl=https://edge.api.flagsmith.com/api/v1/
flagClient.enableLocalEvaluation=false
{"value":60000,"enabled":true,"isDefault":false,"featureId":62178,"featureName":"daisy.settlements.timeout"}
typeof flag.value=number
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。