Skip to content

fix(integrations): Handle windows paths with no prefix or backslash prefix in RewriteFrames #7995

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

Merged
merged 8 commits into from
May 3, 2023

Conversation

srubin
Copy link
Contributor

@srubin srubin commented Apr 28, 2023

Forward slashes are not allowed in Windows paths. This extends RewriteFrames to detect additional Windows-like paths and convert them to use forward slashes.

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

srubin added 2 commits April 28, 2023 10:01
…refix in `RewriteFrames`

Forward slashes are not allowed in Windows paths. This extends RewriteFrames to detect additional Windows-like paths and convert them to use forward slashes.
@srubin srubin marked this pull request as ready for review April 28, 2023 15:10
@Lms24
Copy link
Member

Lms24 commented May 2, 2023

Hi @srubin thanks for opening this PR! On first glance this looks good to me. Gonna let CI run to check for tests. Just out of curiousity, is this something that you need for your use case? Under which circumstances do such frames occur? And furthermore, is there an open issue around this? (if not, that's alright, I just want to ensure we link things appropriately).

@srubin
Copy link
Contributor Author

srubin commented May 2, 2023

We were running into this problem with source maps generated on Windows in webpack. However, I found that I could fix this in our webpack config by standardizing the path separators in devtoolModuleFilenameTemplate.

There's not an open issue around this, and we're not blocked on the fix in this PR. For us it's cleaner to address it upstream (in our webpack config) anyway. So, no complaints if you close this PR!

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation!
Makes sense to me. I'm okay to merge this but it'd be great if you could look into the polynomial regex warning (just to confirm, can you see the CodeQL warning? Not sure about our repo settings here). Any chance that you could come up with a more efficient regex? Considering that this runs for every stack frame I'd like to avoid a potential performance bottleneck (stack trace parsing is already quite resource-intensive as-is).

@srubin srubin force-pushed the steve/windows-rewrite-frames branch from 1e7cf79 to 1f1a00d Compare May 2, 2023 22:32
@srubin
Copy link
Contributor Author

srubin commented May 2, 2023

Updated to use string.includes instead. I had to force push to change a commit message to use the fix(integrations): prefix. If the force push has messed something up here, let me know and I can start a clean branch for the final change.

@Lms24
Copy link
Member

Lms24 commented May 3, 2023

No worries, force push is not a problem (we do it all the time 😅). I restarted CI

@Lms24
Copy link
Member

Lms24 commented May 3, 2023

@srubin can you run yarn fix to fix the linting errors? The other test errors look like flakes to me so I think once the linter is happy, we can merge this.

@Lms24 Lms24 self-assigned this May 3, 2023
@srubin
Copy link
Contributor Author

srubin commented May 3, 2023

Done.

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, then let's merge this. Thanks for contributing @srubin!

@Lms24 Lms24 merged commit 184622d into getsentry:develop May 3, 2023
billyvg pushed a commit that referenced this pull request May 5, 2023
…refix in `RewriteFrames` (#7995)

Forward slashes are not allowed in Windows paths. This fix extends RewriteFrames to detect additional Windows-like paths and convert them to use forward slashes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants