`beforeSend`: type `event_id` and `timestamp` as required
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 65/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
首先沿着 _processEvent 经过 prepareEvent 跟踪到 processBeforeSend,并找到 @sentry/core 中的 beforeSend 和 beforeSendTransaction 回调类型。更新它们的参数类型,使已准备的事件要求包含 event_id 和 timestamp,然后运行相关的 TypeScript 类型检查和测试。完成标准是两个回调都将这些字段声明为必需字段,且现有的回调返回类型保持不变。
由索引模型根据 Issue 内容生成。
描述
Problem Statement
beforeSend receives an ErrorEvent, which inherits event_id?: string and timestamp?: number from Event. But by the time beforeSend runs, both are always set: _processEvent only calls processBeforeSend with the result of prepareEvent, which does
event_id: event.event_id || hint.event_id || uuid4(),
timestamp: event.timestamp || dateTimestampInSeconds(),
So a common beforeSend use, like showing the user the event ID in a "report this error" link, needs a ! or a fallback that can never run.
Solution Brainstorm
Type the beforeSend parameter as ErrorEvent & { event_id: string; timestamp: number } (or a named "prepared event" type), and do the same for beforeSendTransaction. This only narrows a callback parameter, so existing callbacks still type-check, and the return type can stay ErrorEvent | null.
Additional Context
@sentry/core 11.6.0
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
- 主要语言
- TypeScript
- 星标
- 8.8k
- 派生
- 1.9k
- 平均合并
- 1 天 10 小时
- 30 天内合并 PR
- 580
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
getsentry/sentry-javascript 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 80/100
getsentry/sentry-javascript#24860 · 1 条评论 ·
维护者通常 1 天内回复
-
javascript
难度 2/5 1-3 小时 新手友好度 75/100
getsentry/sentry-javascript#24200 · 2 条评论 ·
维护者通常 1 天内回复
-
Cloudflare Workers javascript Tests
难度 2/5 1-3 小时 新手友好度 78/100
getsentry/sentry-javascript#24051 · 1 条评论 ·
维护者通常 1 天内回复
-
Elysia events report as `sentry.javascript.bun`可能已有人在做 @Shubham-Padkonde 于 26 天前认领。 未关闭Bug Bun javascript
难度 2/5 1-3 小时 新手友好度 92/100
getsentry/sentry-javascript#24045 · 1 条评论 ·
维护者通常 1 天内回复
-
javascript
难度 2/5 1-3 小时 新手友好度 75/100
getsentry/sentry-javascript#24043 · 1 条评论 ·
维护者通常 1 天内回复
查看 getsentry/sentry-javascript 的全部 Issue
相似的 Issue
-
fix(frontend): correct VITE_IS_DEVELPOMENT typo in shared/app.ts and align dev environment flags未关闭
难度 2/5 1-3 小时 新手友好度 75/100
vicharanashala/ajrasakha#1439 ·
维护者通常 1 天内回复
-
approved check:passed streams:add
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
backnotprop/plannotator#1932 ·
维护者通常 1 天内回复
-
难度 2/5 半天 新手友好度 62/100
ibm-granite/granite.build#504 ·
维护者通常 2 天内回复
-
reproduced
难度 2/5 1-3 小时 新手友好度 82/100
anomalyco/opencode#55676 · 1 条评论 ·
维护者通常 1 天内回复