diff --git a/services/web/Dockerfile b/services/web/Dockerfile index f4c23fc7cc..8db198fde0 100644 --- a/services/web/Dockerfile +++ b/services/web/Dockerfile @@ -44,3 +44,6 @@ RUN mkdir -p /app/data/dumpFolder && \ USER node CMD ["node", "--expose-gc", "app.js"] + +ARG SENTRY_RELEASE +ENV SENTRY_RELEASE=$SENTRY_RELEASE diff --git a/services/web/app/src/infrastructure/ExpressLocals.js b/services/web/app/src/infrastructure/ExpressLocals.js index 465ed00ed2..9ec9a1c0e2 100644 --- a/services/web/app/src/infrastructure/ExpressLocals.js +++ b/services/web/app/src/infrastructure/ExpressLocals.js @@ -366,9 +366,10 @@ module.exports = function(webRouter, privateApiRouter, publicApiRouter) { recaptchaDisabled: Settings.recaptcha != null ? Settings.recaptcha.disabled : undefined, validRootDocExtensions: Settings.validRootDocExtensions, - sentryAllowedOriginRegex: - Settings.sentry && Settings.sentry.allowedOriginRegex, - sentryDsn: Settings.sentry != null ? Settings.sentry.publicDSN : undefined + sentryAllowedOriginRegex: Settings.sentry.allowedOriginRegex, + sentryDsn: Settings.sentry.publicDSN, + sentryEnvironment: Settings.sentry.environment, + sentryRelease: Settings.sentry.release } next() }) diff --git a/services/web/config/settings.defaults.coffee b/services/web/config/settings.defaults.coffee index ec954eaec5..6f8aa6a6a4 100644 --- a/services/web/config/settings.defaults.coffee +++ b/services/web/config/settings.defaults.coffee @@ -385,13 +385,10 @@ module.exports = settings = # tenderUrl: "" # # Client-side error logging is provided by getsentry.com - # sentry: - # src: "" + sentry: + environment: process.env['SENTRY_ENVIRONMENT'] + release: process.env['SENTRY_RELEASE'] # publicDSN: "" - # - # src should be either a remote url like - # //cdn.ravenjs.com/1.1.22/jquery,native/raven.min.js - # or a local file in the js/libs directory. # The publicDSN is the token for the client-side getSentry service. # Production Settings diff --git a/services/web/frontend/js/utils/sentry.js b/services/web/frontend/js/utils/sentry.js index 7e1468c831..df8a6bdc3e 100644 --- a/services/web/frontend/js/utils/sentry.js +++ b/services/web/frontend/js/utils/sentry.js @@ -6,6 +6,8 @@ if (window.ExposedSettings.sentryDsn) { Sentry.init({ dsn: window.ExposedSettings.sentryDsn, + release: window.ExposedSettings.sentryRelease, + environment: window.ExposedSettings.sentryEnvironment, // Ignore errors unless they come from our origins // Adapted from: https://docs.sentry.io/platforms/javascript/#decluttering-sentry