Skip to content

Fastify integration does not work in ESM mode #12119

Closed
@mohd-akram

Description

@mohd-akram

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

8.2.1

Framework Version

No response

Link to Sentry event

No response

SDK Setup

// app.mjs
import * as Sentry from "@sentry/node";
import { fastify } from "fastify";
const app = fastify();
Sentry.setupFastifyErrorHandler(app);
const address = await app.listen();
console.info(`server listening on ${address}`);
// instrument.mjs
import * as Sentry from "@sentry/node";
Sentry.init({ dsn: process.env.SENTRY_DSN, debug: true });

Steps to Reproduce

  1. node --import ./instrument.mjs app.mjs

Expected Result

Works

Actual Result

[Sentry] Fastify is not instrumented. This is likely because you required/imported fastify before calling `Sentry.init()`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nodeIssues related to the Sentry Node SDK

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions