Skip to content

Commit 2ee27f9

Browse files
authored
improvement: remove sentry dependency (#1435)
* improvement: remove Sentry * update bun.lock
1 parent 0b2ef5e commit 2ee27f9

File tree

10 files changed

+19
-616
lines changed

10 files changed

+19
-616
lines changed

apps/sim/.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ next-env.d.ts
4545
# cursorrules
4646
.cursorrules
4747

48-
# Sentry Config File
49-
.env.sentry-build-plugin
50-
5148
# Uploads
5249
/uploads
5350

apps/sim/app/global-error.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
'use client'
22

3-
import { useEffect } from 'react'
4-
import * as Sentry from '@sentry/nextjs'
53
import NextError from 'next/error'
64

75
export default function GlobalError({ error }: { error: Error & { digest?: string } }) {
8-
useEffect(() => {
9-
Sentry.captureException(error)
10-
}, [error])
11-
126
return (
137
<html lang='en'>
148
<body>

apps/sim/instrumentation-client.ts

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,7 @@
55
* It respects the user's telemetry preferences stored in localStorage.
66
*
77
*/
8-
// This file configures the initialization of Sentry on the client.
9-
// The added config here will be used whenever a users loads a page in their browser.
10-
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
11-
import {
12-
BrowserClient,
13-
breadcrumbsIntegration,
14-
captureRouterTransitionStart,
15-
dedupeIntegration,
16-
defaultStackParser,
17-
getCurrentScope,
18-
linkedErrorsIntegration,
19-
makeFetchTransport,
20-
} from '@sentry/nextjs'
21-
import { env, getEnv } from './lib/env'
22-
import { isProd } from './lib/environment'
23-
24-
// Only in production
25-
if (typeof window !== 'undefined' && isProd) {
26-
const client = new BrowserClient({
27-
dsn: getEnv('NEXT_PUBLIC_SENTRY_DSN') || undefined,
28-
environment: env.NODE_ENV || 'development',
29-
transport: makeFetchTransport,
30-
stackParser: defaultStackParser,
31-
integrations: [breadcrumbsIntegration(), dedupeIntegration(), linkedErrorsIntegration()],
32-
beforeSend(event) {
33-
if (event.request && typeof event.request === 'object') {
34-
;(event.request as any).ip = null
35-
}
36-
return event
37-
},
38-
})
39-
40-
getCurrentScope().setClient(client)
41-
client.init()
42-
}
43-
44-
export const onRouterTransitionStart = isProd ? captureRouterTransitionStart : () => {}
8+
import { env } from './lib/env'
459

4610
if (typeof window !== 'undefined') {
4711
const TELEMETRY_STATUS_KEY = 'simstudio-telemetry-status'

apps/sim/instrumentation-node.ts

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@
55
*/
66

77
import { env } from './lib/env'
8-
import { isProd } from './lib/environment'
98
import { createLogger } from './lib/logs/console/logger.ts'
109

11-
const Sentry = isProd ? require('@sentry/nextjs') : { captureRequestError: () => {} }
12-
1310
const logger = createLogger('OtelInstrumentation')
1411

1512
const DEFAULT_TELEMETRY_CONFIG = {
@@ -85,40 +82,6 @@ async function initializeOpenTelemetry() {
8582
}
8683
}
8784

88-
async function initializeSentry() {
89-
if (!isProd) return
90-
91-
try {
92-
// Skip initialization if Sentry appears to be already configured
93-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
94-
// @ts-ignore accessing internal API
95-
if ((Sentry as any).Hub?.current?.getClient()) {
96-
logger.debug('Sentry already initialized, skipping duplicate init')
97-
return
98-
}
99-
100-
Sentry.init({
101-
dsn: env.NEXT_PUBLIC_SENTRY_DSN || undefined,
102-
enabled: true,
103-
environment: env.NODE_ENV || 'development',
104-
tracesSampleRate: 0.2,
105-
beforeSend(event: any) {
106-
if (event.request && typeof event.request === 'object') {
107-
;(event.request as any).ip = null
108-
}
109-
return event
110-
},
111-
})
112-
113-
logger.info('Sentry initialized (server-side)')
114-
} catch (error) {
115-
logger.error('Failed to initialize Sentry', error as Error)
116-
}
117-
}
118-
11985
export async function register() {
120-
await initializeSentry()
12186
await initializeOpenTelemetry()
12287
}
123-
124-
export const onRequestError = Sentry.captureRequestError

apps/sim/lib/env.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ export const env = createEnv({
8888
// Monitoring & Analytics
8989
TELEMETRY_ENDPOINT: z.string().url().optional(), // Custom telemetry/analytics endpoint
9090
COST_MULTIPLIER: z.number().optional(), // Multiplier for cost calculations
91-
SENTRY_ORG: z.string().optional(), // Sentry organization for error tracking
92-
SENTRY_PROJECT: z.string().optional(), // Sentry project for error tracking
93-
SENTRY_AUTH_TOKEN: z.string().optional(), // Sentry authentication token
9491
LOG_LEVEL: z.enum(['DEBUG', 'INFO', 'WARN', 'ERROR']).optional(), // Minimum log level to display (defaults to ERROR in production, DEBUG in development)
9592

9693
// External Services
@@ -209,7 +206,6 @@ export const env = createEnv({
209206
NEXT_PUBLIC_VERCEL_URL: z.string().optional(), // Vercel deployment URL for preview/production
210207

211208
// Client-side Services
212-
NEXT_PUBLIC_SENTRY_DSN: z.string().url().optional(), // Sentry DSN for client-side error tracking
213209
NEXT_PUBLIC_SOCKET_URL: z.string().url().optional(), // WebSocket server URL for real-time features
214210

215211
// Asset Storage
@@ -257,7 +253,6 @@ export const env = createEnv({
257253
experimental__runtimeEnv: {
258254
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
259255
NEXT_PUBLIC_VERCEL_URL: process.env.NEXT_PUBLIC_VERCEL_URL,
260-
NEXT_PUBLIC_SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN,
261256
NEXT_PUBLIC_BLOB_BASE_URL: process.env.NEXT_PUBLIC_BLOB_BASE_URL,
262257
NEXT_PUBLIC_BILLING_ENABLED: process.env.NEXT_PUBLIC_BILLING_ENABLED,
263258
NEXT_PUBLIC_GOOGLE_CLIENT_ID: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID,

apps/sim/next.config.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { withSentryConfig } from '@sentry/nextjs'
21
import type { NextConfig } from 'next'
32
import { env, isTruthy } from './lib/env'
4-
import { isDev, isHosted, isProd } from './lib/environment'
3+
import { isDev, isHosted } from './lib/environment'
54
import { getMainCSPPolicy, getWorkflowExecutionCSPPolicy } from './lib/security/csp'
65

76
const nextConfig: NextConfig = {
@@ -241,20 +240,4 @@ const nextConfig: NextConfig = {
241240
},
242241
}
243242

244-
const sentryConfig = {
245-
silent: true,
246-
org: env.SENTRY_ORG || '',
247-
project: env.SENTRY_PROJECT || '',
248-
authToken: env.SENTRY_AUTH_TOKEN || undefined,
249-
disableSourceMapUpload: !isProd,
250-
autoInstrumentServerFunctions: isProd,
251-
bundleSizeOptimizations: {
252-
excludeDebugStatements: true,
253-
excludePerformanceMonitoring: true,
254-
excludeReplayIframe: true,
255-
excludeReplayShadowDom: true,
256-
excludeReplayWorker: true,
257-
},
258-
}
259-
260-
export default isDev ? nextConfig : withSentryConfig(nextConfig, sentryConfig)
243+
export default nextConfig

apps/sim/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
"@radix-ui/react-toggle": "^1.1.2",
5959
"@radix-ui/react-tooltip": "1.2.8",
6060
"@react-email/components": "^0.0.34",
61-
"@sentry/nextjs": "^9.15.0",
6261
"@trigger.dev/sdk": "4.0.4",
6362
"@types/pdf-parse": "1.1.5",
6463
"@types/three": "0.177.0",

0 commit comments

Comments
 (0)