getsentry / getsentry/sentry

Simplified file path in event/issue display

Open
#60,627 5 comments 0 reactions 0 assignees View on GitHub
Feature javascript
Dominant language
Python
Stars
44.8k
Forks
4.9k
Avg merge
22h 21m
Merged PRs (30d)
586

Description

### Problem Statement

Currently, stack trace filename is displayed like this, with absolute filename path display by default:
![Screenshot 2023-11-24 at 10 13 03](https://github.com/getsentry/sentry-javascript/assets/389286/d88775b2-6de2-4e31-a3d6-fc9eb4bdf608)

I wanted to simplify filename display to strip common directory from all filenames so I used `RewriteFrames` integration. Using `root` and `prefix` options always show "source not found" notification so I thought it’s related to source maps.
These are source files so there isn’t any source map to upload (as it can be seen from first screenshot, vanilla JS files only).

I thought this could be achieved if I added `abs_path` field to frame inside `iteratee` callback:

```js
{
integrations: [
new RewriteFrames({
iteratee: (frame) => {
frame["abs_path"] = frame.filename;
frame.filename = frame.filename.replace(projectRoot, "");
return frame;
},
}),
],
}
```

But this also shows "source not found" notification:
![Screenshot 2023-11-24 at 10 12 23](https://github.com/getsentry/sentry-javascript/assets/389286/47d2d38d-7019-4391-8c0d-9e94417f60ba)

What I did achieve is I managed to strip project root from filename, with absolute path displayed in tooltip - but still no original source code:
![Screenshot 2023-11-24 at 10 12 13](https://github.com/getsentry/sentry-javascript/assets/389286/31aca274-4a98-43b7-abc3-16c5ab989506)

Is it possible to achieve something like this without resorting to source map upload since there aren’t any source maps to upload?

### Solution Brainstorm

PHP/Symfony integration already has this implemented and shows tooltip with absolute path to filename while still displaying simplified path to filename and original source code. Maybe use approach from there to achieve this?

### Product Area

Issues

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.