Sentry logs are working on the local server but not on the staging server (Node js project).
No error logs are showing in the staging server's sentry.
const Sentry = require('@sentry/node');
const {nodeProfilingIntegration} = require('@sentry/profiling-node');
const {PrismaInstrumentation} = require('@prisma/instrumentation');
try {
Sentry.init({
dsn: process.env.SENTRY_DSN,
enabled: true,
debug: true,
integrations: [
nodeProfilingIntegration(),
Sentry.prismaIntegration({
// Override the default instrumentation that Sentry uses
prismaInstrumentation: new PrismaInstrumentation(),
})
],
// Add Tracing by setting tracesSampleRate
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
// Set sampling rate for profiling
// This is relative to tracesSampleRate
profilesSampleRate: 1.0,
// Alternatively, to control sampling dynamically
// tracesSampler: samplingContext => { /* ... */ }\
environment: process.env.NODE_ENV
});
} catch (error) {
console.error('Sentry initialization failed:', error);
}
Sentry.captureException(new Error('test exception'));