-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(browser): Fix parenthesis parsing logic for chromium #12373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c93fa86
to
1933b22
Compare
size-limit report 📦
|
0.2% bundle increase which busted the size limit for |
@@ -579,6 +579,7 @@ describe('Tracekit - Chrome Tests', () => { | |||
name: 'Error', | |||
stack: `Error: bad | |||
at something (http://localhost:5000/(some)/(thing)/index.html:20:16) | |||
at http://localhost:5000/(group)/[route]/script.js:1:126 | |||
at more (http://localhost:5000/(some)/(thing)/index.html:25:7)`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this could be passed?
at (http://localhost:5000/(group)/[route]/script.js:1:126)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same thought but chrome doesn't emit such frames I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We haven't seen stack lines like that. They only appear to be surrounded in parenthesis when there is filename.
@@ -51,13 +51,22 @@ function createFrame(filename: string, func: string, lineno?: number, colno?: nu | |||
} | |||
|
|||
// Chromium based browsers: Chrome, Brave, new Opera, new Edge | |||
const chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we add a comment here for what this would match, as an example? makes it easier to follow this than to try to parse the regex 😅
nice @lforst when will it be released? |
soon™ |
Thanks for mention! |
Co-authored-by: Tim Fish <[email protected]>
We had a bug where the chrome stack trace parser incorrectly parsed stack frames when the frame was not inside a function (ie. top level in a module) and contained parentheses.
This surfaced in Next.js because Next.js has file based routing with folders that can contain parentheses and our debug ID injection snippet is injected top-level.
We fix this by first using a regex that attempts to match a simple top level module frame, and if it matches we extract the filename and line/colnumbers without attempting to use the more elaborate regex.