File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -178,10 +178,12 @@ export class InboundFilters implements Integration {
178178 try {
179179 if ( event . stacktrace ) {
180180 // tslint:disable-next-line:no-unsafe-any
181- return ( event as any ) . stacktrace . frames [ 0 ] . filename ;
181+ const frames = ( event as any ) . stacktrace . frames ;
182+ return frames [ frames . length - 1 ] . filename ;
182183 } else if ( event . exception ) {
183184 // tslint:disable-next-line:no-unsafe-any
184- return ( event as any ) . exception . values [ 0 ] . stacktrace . frames [ 0 ] . filename ;
185+ const frames = ( event as any ) . exception . values [ 0 ] . stacktrace . frames ;
186+ return frames [ frames . length - 1 ] . filename ;
185187 } else {
186188 return null ;
187189 }
Original file line number Diff line number Diff line change @@ -255,18 +255,28 @@ describe('InboundFilters', () => {
255255 const messageEvent = {
256256 message : 'wat' ,
257257 stacktrace : {
258+ // Frames are always in the reverse order, as this is how Sentry expect them to come.
259+ // Frame that crashed is the last one, the one from awesome-analytics
258260 frames : [
259- {
260- filename : 'https://awesome-analytics.io/some/file .js' ,
261- } ,
261+ { filename : 'https://our-side.com/js/bundle.js' } ,
262+ { filename : 'https://our-side.com/js/bundle .js' } ,
263+ { filename : 'https://awesome-analytics.io/some/file.js' } ,
262264 ] ,
263265 } ,
264266 } ;
265267 const exceptionEvent = {
266268 exception : {
267269 values : [
268270 {
269- stacktrace : { frames : [ { filename : 'https://awesome-analytics.io/some/file.js' } ] } ,
271+ stacktrace : {
272+ // Frames are always in the reverse order, as this is how Sentry expect them to come.
273+ // Frame that crashed is the last one, the one from awesome-analytics
274+ frames : [
275+ { filename : 'https://our-side.com/js/bundle.js' } ,
276+ { filename : 'https://our-side.com/js/bundle.js' } ,
277+ { filename : 'https://awesome-analytics.io/some/file.js' } ,
278+ ] ,
279+ } ,
270280 } ,
271281 ] ,
272282 } ,
You can’t perform that action at this time.
0 commit comments