Skip to content

Pino integration not working #18940

@mmahalwy

Description

@mmahalwy

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

10.32.1

Framework Version

Fastify

Link to Sentry event

No response

Reproduction Example/SDK Setup

logger.ts

import pino from 'pino';
import { IS_PROD_OR_STAGING, envSchema } from './config/appConfig';
import { clsProxify } from 'cls-proxify';

const transport = !IS_PROD_OR_STAGING
  ? { target: 'pino-pretty', options: { colorize: true, ignore: 'hostname' } }
  : undefined;

export const baseLogger = pino({
  transport,
  level: envSchema.LOG_LEVEL,
  timestamp: pino.stdTimeFunctions.isoTime,
  formatters: {
    level: (label) => ({ level: label.toUpperCase() }),
  },
});

const logger = clsProxify(baseLogger);
export default logger;

sentry init

import * as Sentry from '@sentry/node';
import { eventLoopBlockIntegration } from '@sentry/node-native';
import { IS_DEV, envSchema } from '../shared/config/appConfig';
import { postHogClient } from '@shepherd/shared/posthog/postHogClient';
import { nodeProfilingIntegration } from '@sentry/profiling-node';
import { sentryIntegration as posthogIntegration } from 'posthog-node';

const start = () => {
  if (IS_DEV) {
    return;
  }

  const integrations = [
    nodeProfilingIntegration(),
    Sentry.knexIntegration(),
    Sentry.httpIntegration(),
    Sentry.prismaIntegration(),
    Sentry.graphqlIntegration(),
    Sentry.pinoIntegration(),
    Sentry.vercelAIIntegration({
      recordInputs: true,
      recordOutputs: true,
    }),
    Sentry.redisIntegration({
      cachePrefixes: ['pricing:'],
    }),
    eventLoopBlockIntegration({ threshold: 1000 }), // 1 second
  ];

  const ignoredTransactions = [
  ];

  Sentry.init({
    dsn: envSchema.SENTRY_DSN,
    environment: envSchema.SENTRY_ENV,
    beforeSendTransaction(event) {
      if (IS_DEV || ignoredTransactions.includes(event.transaction ?? '')) {
        return null;
      }

      return event;
    },
    tracesSampleRate: 0.5,
    profilesSampleRate: 0.5,
    enableLogs: true,
    release: envSchema.GITHUB_SHA ?? '',
    integrations,
  });
};

start();

Steps to Reproduce

Run server in production, check Sentry. Nothing. Doesn't work on local too.

Expected Result

Seeing logs

Actual Result

No logs are showing up.

Additional Context

I wonder if the order of the integrations has something to do with it?

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions