getsentry / getsentry/sentry-javascript

[Replay] Read response body stream instead of `body.text()`

未關閉
#9,635 1 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
Browser Improvement Replays
主要語言
TypeScript
星號
8.7k
分支
1.8k
平均合併
1 天 18 小時
30 天內合併 PR
541

描述

Currently, we use `await body.text()` to get the response body of a fetch request for replay, both to get the body content as well as to calculate the length of the body.

This has the problem that if the body is a continuous stream, this will never (or very late) resolve. We kind-of solved this recently at least insofar as that we abort after 500ms, but since we still called `await body.text()` before we'll continue to read from the stream, even if we are discarding it.

We should look into reading the stream manually instead of using `body.text()`, which would unlock us being able to stop reading it after some time. But this means we need to take care of text conversion in there ourselves.

Related to https://github.com/getsentry/sentry-javascript/issues/9616

貢獻指南

開啟貢獻指南

研究方向

首先追蹤 Replay 中目前會呼叫 body.text() 的 fetch 回應處理,並閱讀相關 issue 9616 以了解背景。確認可以手動讀取回應串流,同時進行文字轉換與長度計算,並允許連續串流在逾時後停止,而不再繼續消耗 body。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
typescript
領域
web-dev
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。