dev #119

Merged
root merged 2 commits from dev into main 2026-06-09 18:22:36 +03:00
3 changed files with 42 additions and 3 deletions
Showing only changes of commit cdf1ced91a - Show all commits

View File

@@ -11,10 +11,23 @@ const dsn =
const customOtelEnabled = process.env.OTEL_ENABLED === "true";
// dev.sase.tr (staging) and sase.tr (prod) BOTH run NODE_ENV=production, so key
// off the canonical prod host (same signal as isCatalogBackfillEnabled) to tag
// dev events as "staging". An explicit SENTRY_ENVIRONMENT always wins.
const isProdHost =
process.env.COOLIFY_FQDN === "sase.tr" || process.env.BETTER_AUTH_URL === "https://sase.tr";
const environment =
process.env.SENTRY_ENVIRONMENT ||
(isProdHost
? "production"
: process.env.NODE_ENV === "production"
? "staging"
: process.env.NODE_ENV || "development");
if (dsn && process.env.NODE_ENV !== "test") {
Sentry.init({
dsn,
environment: process.env.NODE_ENV || "development",
environment,
serverName: "sase-worker",
sendDefaultPii: true,
enableLogs: true,

View File

@@ -15,10 +15,24 @@ const dsn =
// so they're effectively disabled when the custom pipeline is on.
const customOtelEnabled = process.env.OTEL_ENABLED === "true";
// dev.sase.tr (staging) and sase.tr (prod) BOTH run NODE_ENV=production, so
// NODE_ENV alone can't separate them in Sentry. Key off the canonical prod host
// (same signal as isCatalogBackfillEnabled) so dev events tag as "staging" and
// stay filterable from prod. An explicit SENTRY_ENVIRONMENT always wins.
const isProdHost =
process.env.COOLIFY_FQDN === "sase.tr" || process.env.BETTER_AUTH_URL === "https://sase.tr";
const environment =
process.env.SENTRY_ENVIRONMENT ||
(isProdHost
? "production"
: process.env.NODE_ENV === "production"
? "staging"
: process.env.NODE_ENV || "development");
if (dsn && process.env.NODE_ENV !== "test") {
Sentry.init({
dsn,
environment: process.env.NODE_ENV || "development",
environment,
sendDefaultPii: true,
enableLogs: true,
skipOpenTelemetrySetup: customOtelEnabled,

View File

@@ -21,8 +21,20 @@ export async function initSentry() {
return;
}
// Both dev.sase.tr (staging) and sase.tr (prod) ship a production Vite build
// (MODE === "production"), so MODE can't separate them. Derive from the host at
// runtime instead, so dev errors stay filterable from prod in Sentry. An
// explicit VITE_SENTRY_ENVIRONMENT still wins.
const host = typeof window !== "undefined" ? window.location.hostname : "";
const environment =
import.meta.env.VITE_SENTRY_ENVIRONMENT ?? import.meta.env.MODE ?? "production";
(import.meta.env.VITE_SENTRY_ENVIRONMENT as string | undefined) ??
(host === "sase.tr" || host === "www.sase.tr"
? "production"
: host.endsWith("dev.sase.tr")
? "staging"
: import.meta.env.DEV
? "development"
: "staging");
const release = import.meta.env.VITE_SENTRY_RELEASE;
try {