diff --git a/web/src/api/Config.ts b/web/src/api/Config.ts index a8875d224..01568ae6d 100644 --- a/web/src/api/Config.ts +++ b/web/src/api/Config.ts @@ -3,6 +3,7 @@ import { getCookie } from "../utils"; import { APIMiddleware } from "../elements/notifications/APIDrawer"; import { MessageMiddleware } from "../elements/messages/Middleware"; import { VERSION } from "../constants"; +import { getMetaContent } from "@sentry/tracing/dist/browser/browsertracing"; export class LoggingMiddleware implements Middleware { @@ -53,6 +54,7 @@ export const DEFAULT_CONFIG = new Configuration({ basePath: process.env.AK_API_BASE_PATH + "/api/v3", headers: { "X-CSRFToken": getCookie("authentik_csrf"), + "sentry-trace": getMetaContent("sentry-trace") || "", }, middleware: [ new APIMiddleware(), diff --git a/web/src/api/Sentry.ts b/web/src/api/Sentry.ts index 210f54e40..4761d5524 100644 --- a/web/src/api/Sentry.ts +++ b/web/src/api/Sentry.ts @@ -27,7 +27,10 @@ export function configureSentry(canDoPpi: boolean = false): Promise { ], tracesSampleRate: config.errorReporting.tracesSampleRate, environment: config.errorReporting.environment, - beforeSend: async (event: Sentry.Event, hint: Sentry.EventHint): Promise => { + beforeSend: async (event: Sentry.Event, hint: Sentry.EventHint | undefined): Promise => { + if (!hint) { + return event; + } if (hint.originalException instanceof SentryIgnoredError) { return null; }