Feature values always have type string when using local evaluation mode
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- nodejs, typescript
- Domain
- backend
Research direction
Start with the Flagsmith client path exercised by getEnvironmentFlags() and getFlag() when enableLocalEvaluation is true, using the provided TypeScript script to reproduce the differing value types. Compare the local-evaluation result with the API result and verify that numeric feature values retain their number type in both modes.
Written by the indexing model from the issue text.
Description
We've started seeing an issue where number values like this one are being returned as type string when enableLocalEvaluation is set to true.
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
import Flagsmith from 'flagsmith-nodejs';
async function main(): Promise<void> {
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
- Dominant language
- TypeScript
- Stars
- 30
- Forks
- 27
- Avg merge
- 20h 52m
- Merged PRs (30d)
- 6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Flagsmith/flagsmith-nodejs-client
-
Difficulty 4/5 3-5 days Newbie friendliness 65/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Dependency Dashboard Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Flagsmith/flagsmith-nodejs-client#273 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Flagsmith/flagsmith-nodejs-client#267 · 5 comments ·
All issues in Flagsmith/flagsmith-nodejs-client
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug v2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/inspector#2458 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
carbon-design-system/ibm-products#9907 ·