I know the documentation reads “will ignore errors from whole urls matching a regex pattern”, but I wanted to clarify. I’m hoping to get the Raven client to ignore errors from urls that indicate a brower addon is present, typically something like some.domain.com?addonname=DNSUnlocker&someotherstuff
. Will adding /DNSUnlocker/
to the ignoreUrls
config value get the job done?
If those URLs appear in the stack trace file paths, then yes. (They should.)
Will adding /DNSUnlocker/ to the ignoreUrls config value get the job done?
It should.
@benvinegar Thanks for the reply. We’ve added regex-formatted strings to ignoreUrls
, but we’re still getting errors that we expected to be ignored. To be concrete, we added this to our Raven.config
ignoreUrls
attribute:
'akamaihd.net/loaders/\\d+/l\\.js\\?(?:.+=.*&)*ext=(?:DNSUnlocker|SurfBuyer)'
But yesterday an error was reported in a script from https://cdncache-a.akamaihd.net/loaders/2484/l.js?pid=2484&ext=SurfBuyer&nocache=1&zoneid=88602545
.
The url
reported in the error is from our domain, which we can call https:my-website.com
, but the first line of the stacktrace cites the script from cdncache-a.akamaihd.net
. I’m attaching a screenshot of the issue page in case it helps.
I confirmed that our regex string should match the url of the script by entering the following into the Chrome console:
>> url = 'https://cdncache-a.akamaihd.net/loaders/2484/l.js?pid=2484&ext=SurfBuyer&nocache=1&zoneid=88602545';
>> regexString = 'akamaihd.net/loaders/\\d+/l\\.js\\?(?:.+=.*&)*ext=(?:DNSUnlocker|SurfBuyer)';
>> new RegExp(regexString).test(url)
<- true
Am I misunderstanding how ignoreUrls
works? Or is it possible this is a bug?
@benvinegar: Just to be clear, we are assigning an array to ignoreUrls
. It looks like
ignoreUrls: [
'akamaihd.net/loaders/\\d+/l\\.js\\?(?:.+=.*&)*ext=(?:DNSUnlocker|SurfBuyer)',
'other string'
]
OK OK. The problem is that although I thought I was providing strings to go directly to RegExp()
, in fact there is an intermediate step in raven.js
. The function joinRegExp
transforms strings by escaping some characters: https://github.com/getsentry/raven-js/blob/master/src/raven.js#L1822
I’ve spent a little time trying to massage the pattern strings in our config, but after failing to find strings that will produce the desired RegExp
, I’m going to replace them with RegExp
literals.