Description
Package + Version
@sentry/browser
6.9.0
Description
Originally a question from a customer. TL;DR - Chrome represents anonymous callbacks of methods like Array.forEach
in stacktraces in a weird way. Instead of doing this:
<anonymous> at line x, col y in myscript.js
Array.forEach at line w, col z in myscript.js
it does this:
Array.forEach in <anonymous>
using <anonymous>
as the script name.
(For the record, though Firefox and Safari each do it differently, each one does include the correct script name in the relevant frames.)
If this happens to be the last frame of the stacktrace, it more or less breaks allowUrls
and denyUrls
, because then the thing being filtered on is <anonymous>
.
Three possible solutions off the top of my head:
-
Have the option to filter on more than just the last frame. This is actually a pretty common ask. Related issue: [feature request] Ability to filter events based on any frame #3799
-
Filter on the last frame that has a real URL rather than just the absolute last frame . Hopefully this would be a relatively small change.
-
(Unlikely to happen, but listing it here for completeness) Fix the stacktrace so that it actually correctly includes the two separate frames rather than the one combo frame. We’d have to do some thinking/investigation to determine if it would always work to pull the script name from the
forEach
frame the line and col number from the<anonymous>
frame.