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

Offen Anfängerfreundlich
#26,202 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
76/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
node.js, typescript

Rechercherichtung

Lies packages/core/src/utils/node-stack-trace.ts und untersuche FULL_MATCH; im Bericht steht außerdem, dass der Browser-Parser chromeStackLineParser dieselbe Aufteilung aufweist. Reproduziere das Problem mit den bereitgestellten anonymen V8-Frames, deren Dateipfade ( enthalten, und überprüfe beide Parser. Fertig ist es, wenn diese Frames den vollständigen Dateinamen beibehalten und als anonyme Frames geparst werden, während benannte Frames weiterhin korrekt geparst werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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/

Vorherrschende Sprache
TypeScript
Sterne
8.8k
Forks
1.9k
Ø Merge
1 T. 21 Std.
Gemergte PRs (30 T.)
637

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus getsentry/sentry-javascript

Alle Issues in getsentry/sentry-javascript

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.