Merge branch 'dev' into web/cleanup/20240516-simple-element-docs-1

* dev:
  web: bump @sentry/browser from 7.114.0 to 8.2.1 in /web in the sentry group across 1 directory (#9757)
  core, web: update translations (#9714)
  core: bump sentry-sdk from 2.1.1 to 2.2.0 (#9753)
  core: bump selenium from 4.20.0 to 4.21.0 (#9754)
  core: bump msgraph-sdk from 1.2.0 to 1.4.0 (#9755)
  core: bump github.com/sethvargo/go-envconfig from 1.0.1 to 1.0.2 (#9756)
  web: bump chromedriver from 124.0.3 to 125.0.0 in /tests/wdio (#9758)
  website/docs: new PR for the Entra provider docs (ignore old one) (#9741)
This commit is contained in:
Ken Sternberg
2024-05-17 10:16:36 -07:00
13 changed files with 286 additions and 144 deletions

View File

@ -2,7 +2,14 @@ import { config } from "@goauthentik/common/api/config";
import { VERSION } from "@goauthentik/common/constants";
import { SentryIgnoredError } from "@goauthentik/common/errors";
import { me } from "@goauthentik/common/users";
import * as Sentry from "@sentry/browser";
import {
ErrorEvent,
EventHint,
browserTracingIntegration,
init,
setTag,
setUser,
} from "@sentry/browser";
import { CapabilitiesEnum, Config, ResponseError } from "@goauthentik/api";
@ -12,7 +19,7 @@ export const TAG_SENTRY_CAPABILITIES = "authentik.capabilities";
export async function configureSentry(canDoPpi = false): Promise<Config> {
const cfg = await config();
if (cfg.errorReporting.enabled) {
Sentry.init({
init({
dsn: cfg.errorReporting.sentryDsn,
ignoreErrors: [
/network/gi,
@ -27,7 +34,7 @@ export async function configureSentry(canDoPpi = false): Promise<Config> {
],
release: `authentik@${VERSION}`,
integrations: [
Sentry.browserTracingIntegration({
browserTracingIntegration({
shouldCreateSpanForRequest: (url: string) => {
return url.startsWith(window.location.host);
},
@ -35,10 +42,10 @@ export async function configureSentry(canDoPpi = false): Promise<Config> {
],
tracesSampleRate: cfg.errorReporting.tracesSampleRate,
environment: cfg.errorReporting.environment,
beforeSend: async (
event: Sentry.Event,
hint: Sentry.EventHint | undefined,
): Promise<Sentry.Event | null> => {
beforeSend: (
event: ErrorEvent,
hint: EventHint,
): ErrorEvent | PromiseLike<ErrorEvent | null> | null => {
if (!hint) {
return event;
}
@ -54,9 +61,9 @@ export async function configureSentry(canDoPpi = false): Promise<Config> {
return event;
},
});
Sentry.setTag(TAG_SENTRY_CAPABILITIES, cfg.capabilities.join(","));
setTag(TAG_SENTRY_CAPABILITIES, cfg.capabilities.join(","));
if (window.location.pathname.includes("if/")) {
Sentry.setTag(TAG_SENTRY_COMPONENT, `web/${currentInterface()}`);
setTag(TAG_SENTRY_COMPONENT, `web/${currentInterface()}`);
}
if (cfg.capabilities.includes(CapabilitiesEnum.CanDebug)) {
const Spotlight = await import("@spotlightjs/spotlight");
@ -65,7 +72,7 @@ export async function configureSentry(canDoPpi = false): Promise<Config> {
}
if (cfg.errorReporting.sendPii && canDoPpi) {
me().then((user) => {
Sentry.setUser({ email: user.user.email });
setUser({ email: user.user.email });
console.debug("authentik/config: Sentry with PII enabled.");
});
} else {