Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[sdk/local-evaluation] Multivariate flag with overrides crashes on BigInt serialization (8.1.0) / resolves to a null variant (7.0.3)

未关闭
#273 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
nodejs, typescript
领域
api, backend

调研方向

从 flagsmith-engine/evaluation/evaluationContext/mappers.js 开始,重点查看 mapIdentityOverridesToSegments 和 mapEnvironmentModelToEvaluationContext,然后跟踪 sdk/index.js 如何调用 getIdentityFlagsFromDocument。使用本地评估、多变量 flag、segment 和 identity 覆盖来复现,并比较版本 8.1.0 和 7.0.3。完成标准是 getIdentityFlags() 不抛出异常,并且与远程评估一致地返回已配置的变体值。

由索引模型根据 Issue 内容生成。

描述

Summary

Under local evaluation (enableLocalEvaluation: true), evaluating a multivariate flag fails.
We observe two different behaviours depending on the SDK version, against the same environment:

flagsmith-nodejs Result
8.1.0 (latest) getIdentityFlags() throws TypeError: Do not know how to serialize a BigInt
7.0.3 No throw, but the flag resolves to a null value instead of one of the multivariate variant values — even though enabled is true and the segment matches

Remote evaluation (enableLocalEvaluation: false) resolves the variant correctly in both versions, so this is specific to the local-evaluation engine.

This may be related to #267 (same mapIdentityOverridesToSegments / local-evaluation path), but the trigger and symptom are different, so we're reporting it separately.

Environment
  • flagsmith-nodejs 8.1.0 and 7.0.3
  • Node.js v22.13.1
  • Server-side SDK key, Edge API (https://edge.api.flagsmith.com/api/v1/)
  • enableLocalEvaluation: true, environmentRefreshIntervalSeconds: 60
Steps to reproduce
  1. Create a MULTIVARIATE flag with a weighted split (e.g. 33/34/33 across three options).
  2. Add a segment override for that flag.
  3. Ensure the environment also contains at least one identity override entry.
  4. With enableLocalEvaluation: true, call:
    await flagsmith.getIdentityFlags(identifier, { currency: 'EUR', domain: 'https://www.example.com' });
    

The environment additionally contains several identity_overrides entries (5 in our case, identifiers redacted).

Actual behaviour

8.1.0 — stack trace:

TypeError: Do not know how to serialize a BigInt
    at JSON.stringify (<anonymous>)
    at mapIdentityOverridesToSegments (flagsmith-engine/evaluation/evaluationContext/mappers.js:130:81)
    at mapEnvironmentModelToEvaluationContext (flagsmith-engine/evaluation/evaluationContext/mappers.js:69:36)
    at getEvaluationContext (flagsmith-engine/evaluation/evaluationContext/mappers.js:9:32)
    at Flagsmith.getIdentityFlagsFromDocument (sdk/index.js:385:63)
    at async Flagsmith.getIdentityFlags (sdk/index.js:192:24)

The error is thrown while building the evaluation context, before any specific flag is read, so
it fails getIdentityFlags() for every flag in the environment — not only the multivariate one.

7.0.3: no error, but the value of the multivariate flag comes back as null (the override's
base feature_state_value) instead of one of the configured variant values.

Expected behaviour

getIdentityFlags() should resolve the multivariate flag to one of its variant values (the deterministic percentage split), matching what remote evaluation returns, without throwing.

Thank you in advance for your help

主要语言
TypeScript
星标
30
派生
28
平均合并
7 天 23 小时
30 天内合并 PR
3

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Flagsmith/flagsmith-nodejs-client 的其他 Issue

查看 Flagsmith/flagsmith-nodejs-client 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。