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

Duplicate /track requests return plain text 'Duplicate event', SDK throws JSON parse error

未关闭 适合新手
#579 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript

调研方向

从 packages/core/src/modules/ingest/ingest.routes.ts 开始,检查 /track 的重复响应是如何生成的;然后检查 Web SDK 如何解析非空响应正文。通过在去重时间窗口内发送两次相同事件来复现。完成标准是 SDK 能够解析重复响应,且不会重试或产生控制台错误。

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

描述

What happens

When the ingest dedupe lock catches a duplicate request, /track answers 200 with the plain-text body Duplicate event (DUPLICATE_BODY in packages/core/src/modules/ingest/ingest.routes.ts).

The web SDK (@openpanel/sdk 1.3.1) reads every non-empty response body with JSON.parse:

const n = await i.text(); return n ? JSON.parse(n) : null

So a duplicate request throws SyntaxError: JSON Parse error: Unexpected identifier "Duplicate", the SDK retries and finally logs Max retries reached: SyntaxError: ... to the browser console. Sites that monitor console errors see this as a real-user JavaScript error.

Expected

A response the SDK can parse: either an empty body (e.g. 202) or JSON such as {"duplicate": true}.

Repro

Send the same event to /track twice within the dedupe window from the web SDK and watch the console.

Seen on a self-hosted instance with SDK 1.3.1.

主要语言
TypeScript
星标
7.2k
派生
523
平均合并
16 小时 15 分钟
30 天内合并 PR
30

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

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

Openpanel-dev/openpanel 的其他 Issue

查看 Openpanel-dev/openpanel 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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