Fixed duplicate /assets in Sentry stacktrace filenames (#18777)

no issue

- For whatever reason, our Sentry stack traces are adding an extra
`/assets` to the filenames in stacktraces from admin
- Attempted to fix this
[here](3e9ee16ffb)
but it didn't work because at this point the duplication hasn't occurred
yet
- This change strips the `/assets` segment from the filenames, so when
Sentry adds it back in, it doesn't duplicate anything. Would be good to
get to the bottom of why this is happening, but this should hopefully
improve our stacktraces in Sentry in the meantime.
This commit is contained in:
Chris Raible 2023-10-26 13:45:11 -07:00 committed by GitHub
parent f82a3e0245
commit 42ac31a270
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -184,11 +184,11 @@ export default Route.extend(ShortcutsRoute, {
integrations: [
new RewriteFrames({
iteratee: (frame) => {
console.log('frame: ', frame); // eslint-disable-line no-console
console.log('cdnUrl: ', appConfig.cdnUrl); // eslint-disable-line no-console
// Remove duplicate `assets/` from CDN file paths (unsure why this occurs though)
if (frame.filename?.startsWith(appConfig.cdnUrl) && frame.filename?.includes('assets/assets/')) {
frame.filename = frame.filename.replace('assets/assets/', 'assets/');
if (this.config.sentry_env === 'production') {
// Remove duplicate `assets/` from CDN file paths (unsure why this occurs though)
if (frame.filename?.startsWith(appConfig.cdnUrl) && frame.filename?.includes('assets/')) {
frame.filename = frame.filename.replace('assets/', '');
}
}
return frame;