diff --git a/lib/apollo-client.ts b/lib/apollo-client.ts index e5153c836d3..bdb8cbca15e 100644 --- a/lib/apollo-client.ts +++ b/lib/apollo-client.ts @@ -78,6 +78,7 @@ const serverSideFetch = async (url, options: { headers?: any; agent?: any; body? options.headers['oc-env'] = process.env.OC_ENV; options.headers['oc-secret'] = process.env.OC_SECRET; options.headers['oc-application'] = process.env.OC_APPLICATION; + options.headers['oc-version'] = process.env.HEROKU_SLUG_COMMIT?.slice(0, 7); options.headers['user-agent'] = 'opencollective-frontend/1.0 node-fetch/1.0'; // Start benchmarking if the request is server side @@ -159,7 +160,10 @@ function createLink({ twoFactorAuthContext, accessToken = null }) { const linkFetch = process.browser ? fetch : serverSideFetch; - const httpHeaders = { 'oc-application': process.env.OC_APPLICATION }; + const httpHeaders = { + 'oc-application': process.env.OC_APPLICATION, + 'oc-version': process.env.HEROKU_SLUG_COMMIT?.slice(0, 7), + }; const apiV1DefaultLink = createUploadLink({ uri: getGraphqlUrl('v1'), diff --git a/next.config.js b/next.config.js index 383d2f42e29..3215b74f339 100644 --- a/next.config.js +++ b/next.config.js @@ -69,6 +69,7 @@ const nextConfig = { CAPTCHA_PROVIDER: 'HCAPTCHA', SENTRY_TRACES_SAMPLE_RATE: null, OC_APPLICATION: null, + HEROKU_SLUG_COMMIT: null, LEDGER_SEPARATE_TAXES_AND_PAYMENT_PROCESSOR_FEES: false, }), ); diff --git a/pages/_app.js b/pages/_app.js index 4817eb5b497..b1a82d0f10a 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -137,9 +137,8 @@ class OpenCollectiveFrontendApp extends App { } componentDidCatch(error, errorInfo) { - const errorEventId = sentryLib.captureException(error, { errorInfo }); + const errorEventId = sentryLib.captureException(error, { extra: { errorInfo } }); this.setState({ hasError: true, errorEventId }); - sentryLib.captureException(error, { extra: { errorInfo } }); } componentDidMount() { diff --git a/sentry.default.config.js b/sentry.default.config.js index f8fb694cdae..91bd1675944 100644 --- a/sentry.default.config.js +++ b/sentry.default.config.js @@ -6,6 +6,7 @@ Sentry.configureScope(scope => { scope.setTag('runtimeEngine', typeof window !== 'undefined' ? 'browser' : 'server'); }); +/** @type {import('@sentry/browser/types/client').BrowserClientOptions} */ export default { dsn: process.env.SENTRY_DSN, environment: process.env.OC_ENV, @@ -30,6 +31,6 @@ export default { /^chrome:\/\//i, /^chrome-extension:\/\//i, ], - tracesSampleRate: process.env.SENTRY_TRACES_SAMPLE_RATE ? parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE) : 0.01, + release: process.env.HEROKU_SLUG_COMMIT?.slice(0, 7), };