diff --git a/packages/shared-error-tracking/package.json b/packages/shared-error-tracking/package.json index 53c1284da..a1a47922c 100644 --- a/packages/shared-error-tracking/package.json +++ b/packages/shared-error-tracking/package.json @@ -2,25 +2,13 @@ "name": "@mana/shared-error-tracking", "version": "1.0.0", "description": "Error tracking integration for Mana apps (GlitchTip/Sentry-compatible)", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "main": "./src/index.ts", + "types": "./src/index.ts", "exports": { - ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "./nestjs": { - "types": "./dist/nestjs.d.ts", - "default": "./dist/nestjs.js" - }, - "./browser": { - "types": "./dist/browser.d.ts", - "default": "./dist/browser.js" - } + ".": "./src/index.ts", + "./nestjs": "./src/nestjs.ts", + "./browser": "./src/browser.ts" }, - "files": [ - "dist" - ], "scripts": { "build": "tsc", "type-check": "tsc --noEmit" diff --git a/packages/shared-error-tracking/src/index.ts b/packages/shared-error-tracking/src/index.ts index 73f3877d2..ee6a9deb3 100644 --- a/packages/shared-error-tracking/src/index.ts +++ b/packages/shared-error-tracking/src/index.ts @@ -46,15 +46,23 @@ let initialized = false; export function initErrorTracking(options: ErrorTrackingOptions): void { if (initialized) return; - const dsn = options.dsn || process.env.GLITCHTIP_DSN || process.env.SENTRY_DSN; + const rawDsn = options.dsn || process.env.GLITCHTIP_DSN || process.env.SENTRY_DSN; - if (!dsn) { + if (!rawDsn) { if (options.debug) { console.log(`[ErrorTracking] No DSN configured for ${options.serviceName} - disabled`); } return; } + // Glitchtip projects use UUID-format public_keys (`556fbd2e-a720-...`) + // but @sentry/node v9's DSN parser only accepts alphanumeric — dashes + // trip "Invalid Sentry Dsn" and silently disable transport. Strip them + // from the user/key portion only; the wire format accepts both. + const dsn = rawDsn.replace(/^(https?:\/\/)([\w-]+)(@.+)$/, (_, proto, key, rest) => { + return proto + key.replace(/-/g, '') + rest; + }); + Sentry.init({ dsn, environment: options.environment || process.env.NODE_ENV || 'development', diff --git a/services/mana-auth/Dockerfile b/services/mana-auth/Dockerfile index 6390702b4..e9f945a9f 100644 --- a/services/mana-auth/Dockerfile +++ b/services/mana-auth/Dockerfile @@ -14,6 +14,10 @@ COPY packages/shared-ai ./packages/shared-ai COPY packages/shared-logger ./packages/shared-logger COPY packages/shared-types ./packages/shared-types COPY packages/shared-error-tracking ./packages/shared-error-tracking +# Root package.json devDeps reference @mana/eslint-config; pnpm filter +# install still resolves the root, so the package needs to be present +# even though mana-auth itself doesn't import from it. +COPY packages/eslint-config ./packages/eslint-config # Install only mana-auth and its workspace deps RUN pnpm install --filter @mana/auth... --no-frozen-lockfile --ignore-scripts