normalize() throws when a getter throws a Symbol or a null-prototype object
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, node.js, typescript
调研方向
阅读 packages/core/src/utils/normalize.ts,重点查看 normalize 和 stringifyValue 中的 catch 块。使用 issue 中的三个 getter 示例重现问题,并检查被捕获的值为 Symbol 或无原型对象时,是否仍会作为异常逸出。完成标准是所有情况都返回一个不可序列化标记,且不抛出异常。
由索引模型根据 Issue 内容生成。
描述
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Not applicable. The reproduction calls normalize from @sentry/core directly, without a DSN.
Which SDK are you using?
@sentry/core (the normalize utility that every SDK uses)
SDK Version
11.10.0
Steps to Reproduce
Node.js 24.21.0:
const { normalize } = require('@sentry/core')
const throwsError = { get x() { throw new Error('getter failed') } }
const throwsSymbol = { get x() { throw Symbol('s') } }
const throwsNullProto = { get x() { throw Object.create(null) } }
normalize({ bad: throwsError }, 3)
normalize({ bad: throwsSymbol }, 3)
normalize({ bad: throwsNullProto }, 3)
Expected Result
normalize returns the **non-serializable** marker for all three, as its JSDoc states: "returns A normalized version of the object, or "**non-serializable**" if any errors are thrown during normalization."
Actual Result
{ ERROR: '**non-serializable** (Error: getter failed)' }
TypeError: Cannot convert a Symbol value to a string
TypeError: Cannot convert object to primitive value
The second and third calls throw out of normalize.
Additional Context
Both catch blocks in packages/core/src/utils/normalize.ts (in normalize and in stringifyValue) build the marker with a template literal, `**non-serializable** (${err})`. The template literal converts the caught value to a string. That conversion throws for a Symbol and for an object without a usable toString or Symbol.toPrimitive. The current develop branch has the same code. A conversion that cannot throw, with a fixed fallback text, would keep normalize total.
- 主要语言
- TypeScript
- 星标
- 8.8k
- 派生
- 1.9k
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 664
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
getsentry/sentry-javascript 的其他 Issue
-
Bug Node.js
难度 2/5 1-3 小时 新手友好度 68/100
getsentry/sentry-javascript#25950 · 2 条评论 ·
维护者通常 1 天内回复
-
Browser Bug
难度 2/5 1-3 小时 新手友好度 85/100
getsentry/sentry-javascript#25946 · 2 条评论 ·
维护者通常 1 天内回复
-
Only create Nuxt database and storage spans when there is a parent span可能已有人在做 @nicohrubec 于 5 天前认领。 未关闭Improvement Nuxt
难度 2/5 1-3 小时 新手友好度 83/100
getsentry/sentry-javascript#25805 · 2 条评论 ·
维护者通常 1 天内回复
-
Only create Cloudflare storage and D1 db spans when there is a parent span可能已有人在做 @nicohrubec 于 5 天前认领。 未关闭Cloudflare Workers Improvement Spans
难度 2/5 1-3 小时 新手友好度 78/100
getsentry/sentry-javascript#25804 · 1 条评论 ·
维护者通常 1 天内回复
-
Only create aws-sdk DynamoDB db spans when there is a parent span可能已有人在做 @nicohrubec 于 5 天前认领。 未关闭Bug javascript
难度 2/5 1-3 小时 新手友好度 76/100
getsentry/sentry-javascript#25801 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 getsentry/sentry-javascript 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
riverqueue/river#1576 ·
维护者通常 1 天内回复
-
[bug] A prompt queued during a run is assessed without its text可能已有人在做 @jwiegley 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
DevMortimer/pi-warden#211 ·
维护者通常 1 天内回复
-
enhancement
难度 1/5 1 小时以内 新手友好度 84/100
mattermost/compass-design#191 ·
维护者通常 1 天内回复
-
Add unit tests for the organization admin role check可能已有人在做 @SaffuSafwan 今天认领。 未关闭area/core good first issue help wanted
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
HorusGoul/trizum#559 · 1 条评论 ·
维护者通常 1 天内回复