-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fastify integration does not work in ESM mode #12119
Comments
I'm also getting the same issue. I followed this page: https://docs.sentry.io/platforms/javascript/guides/fastify/. I also double checked that I import Sentry before importing anything from fastify. I'm running node v22.1.0 and sentry v8.2.1 |
Hi, thank you for filing this. It looks like open-telemetry doesn't properly instrument the named export of fastify. As a workaround, could you change your code to use the default export and report back please? import fastify from 'fastify' We are looking into raising this upstream with open-telemetry in the meantime. |
It does not seem to make a difference. The full log:
|
Which node version are you running? |
I'm running v20.13.1. Weirdly, making that change actually works in my production code. There, I have a |
From my testing, the issue with your sample code is two-fold. One is the named export not being instrumented properly by otel. The other is that you do not have The messaging around that is definitely confusing though and leads users down the wrong path. I'll raise it with the team. |
Ah, that explains it. Yes, the following works: // 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,
tracesSampleRate: 0.05,
}); |
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
Steps to Reproduce
node --import ./instrument.mjs app.mjs
Expected Result
Works
Actual Result
The text was updated successfully, but these errors were encountered: