nuxt-community / sentry-module

Sentry module for Nuxt 2
https://sentry.nuxtjs.org
MIT License
501 stars 114 forks source link

fix: set `root` for RewriteFrames integration #650

Closed rchl closed 7 months ago

rchl commented 7 months ago

After manually inspecting some crashes I've realized that the RewriteFrames integration that the module enables by default does more harm than good.

In case there are source maps it doesn't really make any difference since stack frame paths are resolved from source maps then.

In case there are no source maps (for example when crash is within the server code and not inside the webpack context) then what RewriteFrames does is it strips the whole path leaving just the file name. That can result in just index.js being shown, for example, which makes it unclear which file is being referred to.

To fix that, set root option on the server so that the paths are resolved relative to Nuxt's rootDir.

Also don't enable RewriteFrames integration on the client since it doesn't seem to be useful there. It only does something when the stack frame path is a local file path and on the client-side I don't see this being the case.

github-actions[bot] commented 7 months ago

size-limit report 📦

Path Size
fixture: base 379.64 KB (-0.57% 🔽)
fixture: replay 498.79 KB (-0.43% 🔽)
fixture: lazy 384.43 KB (-0.56% 🔽)
fixture: tracing 399.83 KB (-0.54% 🔽)
fixture: lazy+tracing 404.59 KB (-0.53% 🔽)
fixture: typescript 379.77 KB (-0.57% 🔽)