Skip to content

Sentry doesn't emit any instrumentation events when using Fastify adapter #14400

Closed
@LuisCarrilloR

Description

@LuisCarrilloR

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nestjs

SDK Version

8.39.0

Framework Version

NestJS 10.3.10

Link to Sentry event

No response

Reproduction Example/SDK Setup

Having the following configuration, the app continously logs Isolation scope is still the default isolation scope, skipping setting transactionName.

// instrument.ts
import * as Sentry from '@sentry/nestjs';
import { nodeProfilingIntegration } from '@sentry/profiling-node';

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  environment: process.env.NODE_ENV,
  integrations: [nodeProfilingIntegration()],
  debug: true,
  release: process.env.NODE_ENV,
  enabled: process.env.API_TRACING_ENABLED === 'true',
  tracesSampler: (samplingContext) => {
    if (samplingContext?.transactionContext?.name === 'GET /') {
      return 0;
    }
    return 0.1;
  },
  profilesSampleRate: 1.0,
});
// main.ts
import * as dotenv from 'dotenv';
dotenv.config();

import '@shared/config/modules/sentry/instrument'; // Sentry import
import { NestFactory, Reflector } from '@nestjs/core';
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';

async function bootstrap() {
  const adapter = new FastifyAdapter();
  
// some adapter configs here

  const app = await NestFactory.create<NestFastifyApplication>(AppModule, adapter);


  await app.listen(process.env.PORT ? parseInt(process.env.PORT) : 80, '0.0.0.0');
  console.log('Server runing in port', process.env.PORT || 'default (80)');
}
bootstrap();

Steps to Reproduce

  1. Setup Client.
  2. Init application.
2024-11-21T00:03:16.243-06:00 | > node dist/main.js
-- | --
  | 2024-11-21T00:03:20.015-06:00 | Sentry Logger [log]: Initializing Sentry: process: 18, thread: main.
  | 2024-11-21T00:03:20.018-06:00 | Sentry Logger [log]: Running in CommonJS mode.
  | 2024-11-21T00:03:20.022-06:00 | Sentry Logger [debug]: @opentelemetry/api: Registered a global for diag v1.9.0.
  | 2024-11-21T00:03:20.025-06:00 | Sentry Logger [debug]: @opentelemetry/api: Registered a global for trace v1.9.0.
  | 2024-11-21T00:03:20.025-06:00 | Sentry Logger [debug]: @opentelemetry/api: Registered a global for context v1.9.0.
  | 2024-11-21T00:03:20.026-06:00 | Sentry Logger [debug]: @opentelemetry/api: Registered a global for propagation v1.9.0.
  | 2024-11-21T00:03:34.513-06:00 | �[32m[Nest] 18 - �[39m11/21/2024, 6:03:34 AM �[32m LOG�[39m �[38;5;3m[NestFactory] �[39m�[32mStarting Nest application...�[39m
  | 2024-11-21T00:03:35.803-06:00 | �[32m[Nest] 18 - �[39m11/21/2024, 6:03:35 AM �[32m LOG�[39m �[38;5;3m[InstanceLoader] �[39m�[32mSentryModule dependencies initialized�[39m�[38;5;3m +1293ms�[39m


  1. No transactions are detected.
  2. Logs continuously show
Sentry Logger [warn]: Isolation scope is still the default isolation scope, skipping setting transactionName.
Sentry Logger [warn]: Isolation scope is still the default isolation scope, skipping setting transactionName.
Sentry Logger [warn]: Isolation scope is still the default isolation scope, skipping setting transactionName.
Sentry Logger [log]: Flushing client reports based on interval.
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: No outcomes to send

Expected Result

I expect to see at least some transactions in Sentry but nothing is being sent.

Actual Result

Events are not being detected while using the app

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nestjsIssues related to the Sentry Nestjs SDK

    Type

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions