From 51f44568b86c1943d09cc58b1d58df19997f102b Mon Sep 17 00:00:00 2001 From: Oliver Browne Date: Fri, 22 Nov 2024 13:21:01 +0200 Subject: [PATCH] fix(err): check for node_modules when guessing in_app (#26354) --- rust/cymbal/src/langs/js.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rust/cymbal/src/langs/js.rs b/rust/cymbal/src/langs/js.rs index 8b4ccaac385..f98902bddea 100644 --- a/rust/cymbal/src/langs/js.rs +++ b/rust/cymbal/src/langs/js.rs @@ -155,13 +155,19 @@ impl From<(&RawJSFrame, SourceLocation<'_>)> for Frame { ScopeLookupResult::Unknown => None, }; + let source = token.file().and_then(|f| f.name()).map(|s| s.to_string()); + + let in_app = source + .map(|s| !s.contains("node_modules")) + .unwrap_or(raw_frame.in_app); + let mut res = Self { raw_id: String::new(), // We use placeholders here, as they're overriden at the RawFrame level mangled_name: raw_frame.fn_name.clone(), line: Some(token.line()), column: Some(token.column()), source: token.file().and_then(|f| f.name()).map(|s| s.to_string()), - in_app: raw_frame.in_app, + in_app, resolved_name, lang: "javascript".to_string(), resolved: true,