Skip to content

Unable to instrument Nestjs app when the Fastify Adapter is used #13388

Closed
@samuelgoldenbaum

Description

@samuelgoldenbaum

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.26.0

Framework Version

@nestjs/platform-fastify ^10.4.1

Link to Sentry event

No response

Reproduction Example/SDK Setup

The following will not instrument...

const initSentry = (): Promise<void> => {
  return new Promise((resolve) => {
    Sentry.init({
      dsn: 'DSN,
      integrations: [nodeProfilingIntegration()],
      tracesSampleRate: 1.0,
      profilesSampleRate: 1.0
    });
    return resolve();
  });
};

async function bootstrap() {
  const app = await NestFactory.create<NestFastifyApplication>(
    AppModule,
    new FastifyAdapter()
  );

  await app.listen(3000);
}

initSentry().then(() => bootstrap());

But using Express will

const initSentry = (): Promise<void> => {
  return new Promise((resolve) => {
    Sentry.init({
      dsn: 'DSN',
      integrations: [nodeProfilingIntegration()],
      tracesSampleRate: 1.0,
      profilesSampleRate: 1.0
    });
    return resolve();
  });
};

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  await app.listen(3000);
}

initSentry().then(() => bootstrap());

Steps to Reproduce

Swap to the Fastify adapter:

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

  await app.listen(3000);

Expected Result

Should instrument and show data in Performance tab

Actual Result

No instrumentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nestjsIssues related to the Sentry Nestjs SDK

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions