Custom source map URLs

Custom source map URLs allow you to specify where Airbrake should look for the source map to any minified file. Custom source map URLs can be used with public and private source maps.

When to use custom source map URLs

You should use custom source map URLs if you match either of these two cases:

  1. Your source maps are not accessible according to the public source maps rules (ie: they are publicly accessible but in a different place).
  2. Your source maps are privately uploaded but need to be matched to minified code with more granularity than private source maps pattern provides (eg: if app.min.js could either be mapped to version-1/app.map.js or version-2/app.map.js).

How to use custom source map URLs

Custom source map URLs are supported by assigning a special property of notice.context called sourceMaps. The keys of the sourceMaps object represent shell filename patterns and the values are URLs of your source maps.

airbrake.addFilter(function(notice) {
  notice.context.sourceMaps = {
    'https://example.com/app.min.js': 'https://example.com/app.min.js.map'
  };
  return notice;
});

Filename pattern uses Unix glob-like syntax:

  • * matches any sequence of non-path-separators
  • ** matches any sequence of characters, including path separators
  • ? matches any single non-path-separator character

For example:

airbrake.addFilter(function(notice) {
  notice.context.sourceMaps = {
    'PATTERN/app.min.js': 'https://example.com/app.min.js.map'
  };
  return notice;
});