var initErrorLogging = function() { if( Sentry.getCurrentHub().getClient() ){ console.log('Sentry is already initialized.'); return; } var sentryBeforeSend = function(event) { var multiplier = Math.pow(10, 2), loadedResources = getLoadedResources(), requireBaseConfigLoaded = false, tags = event.tags, sentryErrorUrl = 'https://sentry.io/organizations/eventbrite-eng/issues/?environment=[app.environment]&query=is%3Aunresolved+lastSeen%3A-1h', allScriptTags; function round(number) { return Math.round(number * multiplier) / multiplier; } function getLoadedResources() { try { return performance .getEntriesByType('resource') .filter(function(resource) {return resource.initiatorType === 'script' || resource.initiatorType === 'link';}) .map(function(resource) {return '(' + round(resource.duration) + 'ms) ' + resource.name;}); } catch(ex) { return []; } } event.loadedResources = loadedResources; // Do some extra checking for the listing page which is a cause of a lot // of script loading issues if (event.contexts.application.feature_name === 'listing') { // check to see if require_base_config.js was loaded for (var i = 0; i < loadedResources.length; i++) { if (loadedResources[i].indexOf('require_base_config.js') > -1) { requireBaseConfigLoaded = true; break; } } // if not, find the script tag with the src and make a fetch call // to see if there's a problem with the URL, it was a blip, etc. // this should help debug the problem better. if (!requireBaseConfigLoaded && window.fetch) { allScriptTags = document.querySelectorAll('script'); for (var i = 0; i < allScriptTags.length; i++) { if (allScriptTags[i].src && allScriptTags[i].src.indexOf('require_base_config.js') > -1) { // returning a promise makes beforeSend act asynchronously so it'll // wait until the promise resolves/rejects. // if the fetch was successful, then we return the status code. this would // mean that the initial load for require_base_config failed, but a subsequent // one passed. if the fetch was unsuccessful then we'll get the error message // to see what's going on. return fetch(allScriptTags[i].src) .then( function(resp) { tags['require_base_config'] = resp.status; }, function(err) { tags['require_base_config'] = err.message; } ) .then(function() {tags['require_base_config_url'] = allScriptTags[i]; }); } } } } event.loadedResources = loadedResources; return event; }; var context = {"environment":"production","feature_name":"listing","user":{"lang":"en-us","attendee":false,"session":"YGGklNX9l_kPAMrK1txWhA","authenticated":false,"has_any_global_permission":false,"locale":"en_US","id":null,"email":null},"appName":"core-frontend","debug":"true","should_log_errors":"true","tags":{"eventId":1480658020999,"commit":"339238d","serverName":"62955608eb6b","branch":"rc2025","organizerId":"86260787113"},"appVersion":"1990039-rc2025-07-10_20.04-py27-339238d"} Sentry.init({ debug: context.debug, enabled: context.should_log_errors, dsn: 'https://b3bf521ead2a4534809e4b294dda0b39@o375540.ingest.sentry.io/6099049', integrations: [ new Sentry.Integrations.Dedupe(), new Sentry.Integrations.ExtraErrorData(), ], autoSessionTracking: true, initialScope: { user: context.user, contexts: { application: { appName: context.appName, appVersion: context.appVersion, environment: context.environment, feature_name: context.feature_name, }, }, tags: Object.assign({}, context.tags, { appName: context.appName, appVersion: context.appVersion, environment: context.environment, }) }, environment: context.environment, beforeSend: sentryBeforeSend, tracesSampleRate: 1.0, }); if (window.console) console.log('core-frontend: sentry error reporting initialized'); }