Node stack parser splits anonymous frames at ` (` inside the file path (`C:\Program Files (x86)\...`, `My App (beta)/...`)

未關閉 適合新手
#26,202 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
76/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
node.js, typescript

研究方向

閱讀packages/core/src/utils/node-stack-trace.ts並檢查FULL_MATCH;報告也指出,瀏覽器解析器chromeStackLineParser會進行相同的拆分。使用提供的匿名 V8 frame 重現問題,這些 frame 的檔案路徑包含 (,並檢查兩個解析器。完成標準是這些 frame 保留完整檔名並被解析為匿名 frame,同時具名 frame 仍能正確解析。

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

描述

Bug Node.js Waiting for: Product Owner
Is there an existing issue for this?
How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

11.11.0 (also develop 6c6c040256)

Framework Version

Node.js v26.13.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

/home/me/My App (beta)/index.js:

const { defaultStackParser } = require("@sentry/node");
try {
  [1].forEach(() => {
    throw new Error("boom");
  });
} catch (err) {
  console.log(err.stack.split("\n")[1]);
  const top = defaultStackParser(err.stack).pop();
  console.log(top.filename, "|", top.function, top.lineno, top.colno);
}
Steps to Reproduce

Run node index.js from a directory whose path contains a space followed by (. The same happens for any anonymous V8 frame such as at C:\Program Files (x86)\MyApp\index.js:2:9 or at async /home/me/My App (beta)/index.js:2:9.

Expected Result
    at /home/me/My App (beta)/index.js:4:11
/home/me/My App (beta)/index.js | ? 4 11
Actual Result
    at /home/me/My App (beta)/index.js:4:11
beta)/index.js | /home/me/My App 4 11

Parsing at C:\Program Files (x86)\MyApp\index.js:2:9 returns {"function":"C:\\Program Files","filename":"x86)\\MyApp\\index.js","in_app":false}. Named frames (at main (/home/me/My App (beta)/index.js:5:3)) are parsed as expected.

Additional Context

FULL_MATCH in packages/core/src/utils/node-stack-trace.ts is /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/; the optional lazy (.+?)\s+\( function-name group matches up to the first ( in the path even when the line has no name ( prefix. The truncated filename no longer starts with / or a Windows drive letter, so filenameIsInApp also returns false, and source map lookup and code context fail for these frames. The browser chromeStackLineParser shows the same split for Node-style frames.

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.

Credit: https://ucsbplse.github.io/

主要語言
TypeScript
星號
8.8k
分支
1.9k
平均合併
1 天 21 小時
30 天內合併 PR
637

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

getsentry/sentry-javascript 的其他 Issue

查看 getsentry/sentry-javascript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

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

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