Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/docu/content/docs/deployment/vercel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ OLLAMA_BASE_URL=https://ollama.yourdomain.com
RESEND_API_KEY=re_...
PORT=3001
NODE_ENV=production
ERROR_REPORTING_DSN=https://...
SENTRY_DSN=https://...
```

**For Web (`apps/next`):**
```bash
NEXT_PUBLIC_API_URL=https://api.yourdomain.com
NEXT_PUBLIC_ERROR_REPORTING_DSN=https://...
NEXT_PUBLIC_SENTRY_DSN=https://...
```

**For Docs (`apps/docu`):**
Expand Down
4 changes: 2 additions & 2 deletions apps/fastify/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ if (env.NODE_ENV === 'production' && env.ALLOW_TEST) {
}

initErrorReporting({
dsn: env.ERROR_REPORTING_DSN,
environment: env.ERROR_REPORTING_ENVIRONMENT ?? env.NODE_ENV,
dsn: env.SENTRY_DSN,
environment: env.SENTRY_ENVIRONMENT ?? env.NODE_ENV,
})

const isTestOrCi = env.NODE_ENV === 'test' || env.CI
Expand Down
4 changes: 2 additions & 2 deletions apps/fastify/src/lib/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export const env = createEnv({
BODY_LIMIT: z.coerce.number().int().positive().default(1048576),
REQUEST_TIMEOUT: z.coerce.number().int().positive().default(30000),
LOG_LEVEL: z.enum(['debug', 'info', 'warn', 'error', 'silent']).default('info'),
ERROR_REPORTING_DSN: z.string().min(1).optional(),
ERROR_REPORTING_ENVIRONMENT: z.string().min(1).optional(),
SENTRY_DSN: z.string().min(1).optional(),
SENTRY_ENVIRONMENT: z.string().min(1).optional(),
OLLAMA_BASE_URL: z.string().url().optional().default('http://localhost:11434'),
AI_PROVIDER: z.enum(['ollama', 'openrouter']).optional(),
OPEN_ROUTER_API_KEY: z.string().min(1).optional(),
Expand Down
4 changes: 2 additions & 2 deletions apps/next/error-reporting.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { initErrorReporting } from '@repo/error/nextjs'
import { env } from './lib/env.js'

initErrorReporting({
dsn: env.NEXT_PUBLIC_ERROR_REPORTING_DSN,
environment: env.NEXT_PUBLIC_ERROR_REPORTING_ENVIRONMENT ?? env.NEXT_PUBLIC_NODE_ENV,
dsn: env.NEXT_PUBLIC_SENTRY_DSN,
environment: env.NEXT_PUBLIC_SENTRY_ENVIRONMENT ?? env.NEXT_PUBLIC_NODE_ENV,
})
4 changes: 2 additions & 2 deletions apps/next/error-reporting.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { initErrorReporting } from '@repo/error/nextjs'
import { env } from './lib/env.js'

initErrorReporting({
dsn: env.ERROR_REPORTING_DSN,
environment: env.ERROR_REPORTING_ENVIRONMENT ?? env.NODE_ENV,
dsn: env.SENTRY_DSN,
environment: env.SENTRY_ENVIRONMENT ?? env.NODE_ENV,
})
16 changes: 8 additions & 8 deletions apps/next/lib/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ export const env = createEnv({
)
: z.string().min(32).default('default-jwt-secret-min-32-chars-for-dev'),
NEWSAPI_KEY: z.string().optional(),
ERROR_REPORTING_DSN: z.string().min(1).optional(),
ERROR_REPORTING_ENVIRONMENT: z.string().min(1).optional(),
SENTRY_DSN: z.string().min(1).optional(),
SENTRY_ENVIRONMENT: z.string().min(1).optional(),
},
client: {
NEXT_PUBLIC_NODE_ENV: z.enum(['development', 'test', 'production']).default('production'),
NEXT_PUBLIC_API_URL: z.string().min(1),
NEXT_PUBLIC_GOOGLE_CLIENT_ID: z.string().min(1).optional(),
NEXT_PUBLIC_AUTH_COOKIE_NAME: z.string().default('api.session'),
NEXT_PUBLIC_ERROR_REPORTING_DSN: z.string().min(1).optional(),
NEXT_PUBLIC_ERROR_REPORTING_ENVIRONMENT: z.string().min(1).optional(),
NEXT_PUBLIC_SENTRY_DSN: z.string().min(1).optional(),
NEXT_PUBLIC_SENTRY_ENVIRONMENT: z.string().min(1).optional(),
// Logging configuration
NEXT_PUBLIC_LOG_ENABLED: z.coerce.boolean().optional(),
NEXT_PUBLIC_LOG_LEVEL: z.enum(['debug', 'info', 'warn', 'error', 'silent']).optional(),
Expand All @@ -44,10 +44,10 @@ export const env = createEnv({
NEXT_PUBLIC_GOOGLE_CLIENT_ID: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID,
NEXT_PUBLIC_AUTH_COOKIE_NAME:
process.env.NEXT_PUBLIC_AUTH_COOKIE_NAME ?? process.env.AUTH_COOKIE_NAME,
NEXT_PUBLIC_ERROR_REPORTING_DSN: process.env.NEXT_PUBLIC_ERROR_REPORTING_DSN,
NEXT_PUBLIC_ERROR_REPORTING_ENVIRONMENT: process.env.NEXT_PUBLIC_ERROR_REPORTING_ENVIRONMENT,
ERROR_REPORTING_DSN: process.env.ERROR_REPORTING_DSN,
ERROR_REPORTING_ENVIRONMENT: process.env.ERROR_REPORTING_ENVIRONMENT,
NEXT_PUBLIC_SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN,
NEXT_PUBLIC_SENTRY_ENVIRONMENT: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT,
SENTRY_DSN: process.env.SENTRY_DSN,
SENTRY_ENVIRONMENT: process.env.SENTRY_ENVIRONMENT,
NEXT_PUBLIC_LOG_ENABLED: process.env.NEXT_PUBLIC_LOG_ENABLED,
NEXT_PUBLIC_LOG_LEVEL: process.env.NEXT_PUBLIC_LOG_LEVEL,
NEXT_PUBLIC_LEGAL_EMAIL: process.env.NEXT_PUBLIC_LEGAL_EMAIL,
Expand Down
4 changes: 2 additions & 2 deletions apps/next/sentry.edge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { initErrorReporting } from '@repo/error/nextjs'
import { env } from './lib/env.js'

initErrorReporting({
dsn: env.ERROR_REPORTING_DSN,
environment: env.ERROR_REPORTING_ENVIRONMENT ?? env.NODE_ENV,
dsn: env.SENTRY_DSN,
environment: env.SENTRY_ENVIRONMENT ?? env.NODE_ENV,
})
8 changes: 4 additions & 4 deletions packages/error/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Error reporting and utilities for the monorepo. Use **`captureError`** for consi

## Error reporting backend

**GlitchTip** (open source) is recommended. Sentry (open source or cloud) also works—same DSN format and SDK. Set `ERROR_REPORTING_DSN` (server) and `NEXT_PUBLIC_ERROR_REPORTING_DSN` (client) to enable.
**GlitchTip** (open source) is recommended. Sentry (open source or cloud) also works—same DSN format and SDK. Set `SENTRY_DSN` (server) and `NEXT_PUBLIC_SENTRY_DSN` (client) to enable.

## Quick start

Expand Down Expand Up @@ -52,8 +52,8 @@ Use `initErrorReporting` from the platform path. **Do NOT call it from `instrume
import { initErrorReporting } from '@repo/error/node'

initErrorReporting({
dsn: env.ERROR_REPORTING_DSN,
environment: env.ERROR_REPORTING_ENVIRONMENT ?? env.NODE_ENV,
dsn: env.SENTRY_DSN,
environment: env.SENTRY_ENVIRONMENT ?? env.NODE_ENV,
})
```

Expand All @@ -65,7 +65,7 @@ Do **not** call `initErrorReporting` inside `instrumentation.ts` `register()`. I

## No-DSN fallback

When no DSN is configured, errors are logged via the provided or default logger instead of being dropped. Set `ERROR_REPORTING_DSN` to enable full reporting.
When no DSN is configured, errors are logged via the provided or default logger instead of being dropped. Set `SENTRY_DSN` to enable full reporting.

## Scripts

Expand Down
2 changes: 1 addition & 1 deletion packages/error/src/core/capture-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function createCaptureError(reporting: ReportingAdapter, defaultLogger: L
if (!reportingWarningShown) {
const log = options.logger ?? defaultLogger
log.warn(
'Error reporting not initialized - errors will be logged only. Set ERROR_REPORTING_DSN to enable.',
'Error reporting not initialized - errors will be logged only. Set SENTRY_DSN to enable.',
)
reportingWarningShown = true
}
Expand Down
25 changes: 16 additions & 9 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
"VERCEL_ENV",
"VERCEL_GIT_COMMIT_REF",
"AUTH_COOKIE_NAME",
"NEXT_PUBLIC_AUTH_COOKIE_NAME"
"NEXT_PUBLIC_AUTH_COOKIE_NAME",
"SENTRY_ORG",
"SENTRY_PROJECT",
"SENTRY_AUTH_TOKEN"
]
},
"lint": {},
Expand Down Expand Up @@ -70,11 +73,13 @@
"DEBUG_TEST",
"APP_URL",
"EMAIL_ASSETS_URL",
"ERROR_REPORTING_DSN",
"ERROR_REPORTING_ENVIRONMENT",
"NEXT_PUBLIC_ERROR_REPORTING_DSN",
"SENTRY_DSN",
"SENTRY_ENVIRONMENT",
"NEXT_PUBLIC_SENTRY_DSN",
"NEXT_PUBLIC_SENTRY_ENVIRONMENT",
"SENTRY_ORG",
"SENTRY_PROJECT"
"SENTRY_PROJECT",
"SENTRY_AUTH_TOKEN"
]
},
"lint:eslint:fix": {
Expand Down Expand Up @@ -108,11 +113,13 @@
"DEBUG_TEST",
"APP_URL",
"EMAIL_ASSETS_URL",
"ERROR_REPORTING_DSN",
"ERROR_REPORTING_ENVIRONMENT",
"NEXT_PUBLIC_ERROR_REPORTING_DSN",
"SENTRY_DSN",
"SENTRY_ENVIRONMENT",
"NEXT_PUBLIC_SENTRY_DSN",
"NEXT_PUBLIC_SENTRY_ENVIRONMENT",
"SENTRY_ORG",
"SENTRY_PROJECT"
"SENTRY_PROJECT",
"SENTRY_AUTH_TOKEN"
]
},
"checktypes": { "env": ["NODE_ENV"] },
Expand Down
Loading