Comments (7)
It does not seem to make a difference. The full log:
Sentry Logger [log]: Initializing Sentry: process: 90697, thread: main.
Sentry Logger [log]: Integration installed: InboundFilters
Sentry Logger [log]: Integration installed: FunctionToString
Sentry Logger [log]: Integration installed: LinkedErrors
Sentry Logger [log]: Integration installed: RequestData
Sentry Logger [log]: Integration installed: Console
Sentry Logger [log]: Integration installed: Http
Sentry Logger [log]: Integration installed: NodeFetch
Sentry Logger [log]: Integration installed: OnUncaughtException
Sentry Logger [log]: Integration installed: OnUnhandledRejection
Sentry Logger [log]: Integration installed: ContextLines
Sentry Logger [log]: Integration installed: LocalVariablesAsync
Sentry Logger [log]: Integration installed: Context
Sentry Logger [debug]: @opentelemetry/api: Registered a global for diag v1.8.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for trace v1.8.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for context v1.8.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for propagation v1.8.0.
Sentry Logger [debug]: @opentelemetry/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'http' }
Sentry Logger [debug]: @opentelemetry/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'https' }
[Sentry] Fastify is not instrumented. This is likely because you required/imported fastify before calling `Sentry.init()`.
from sentry-javascript.
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 tracesSampleRate
set up in your Sentry.init
call, which is why nothing's instrumented.
The messaging around that is definitely confusing though and leads users down the wrong path. I'll raise it with the team.
from sentry-javascript.
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,
});
from sentry-javascript.
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
from sentry-javascript.
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.
from sentry-javascript.
Which node version are you running?
from sentry-javascript.
I'm running v20.13.1. Weirdly, making that change actually works in my production code. There, I have a bin/server
in CJS that await imports
fastify and the ESM app and sets up the server. I'll try to see what exactly is causing it to work or not.
from sentry-javascript.
Related Issues (20)
- Property 'setupNestErrorHandler' does not exist on type 'typeof import("/app/node_modules/@sentry/node/types/index")' HOT 5
- [contextLines]: reduce memory usage HOT 3
- Ember Canary ember-release Test Failed HOT 2
- nextjs-14 (canary) Test Failed
- nextjs-app-dir (canary) Test Failed HOT 1
- Astro Integration throws error after upgrade to v8.3.0 HOT 8
- Add support for angular v18 HOT 1
- Mongo instrumentation doesn't work with promises HOT 4
- Replay no longer reexported by @sentry/nextjs after upgrade to v8 HOT 1
- Release v8 for loader script HOT 3
- Create versioned global sentry carrier object
- Astro integration follow the guide will get a error ENOENT: no such file or directory, open '/Users/xxx/astro-project/node_modules/@sentry/astro/esm/@sentry/node' HOT 1
- nextjs-15 (latest) Test Failed
- nextjs-14 (latest) Test Failed HOT 3
- Add React 19 peer dep HOT 2
- Sentry.feedbackIntegration TypeScript autocomplete not working
- Implement `metrics.timing()`
- The `failure_issue_threshold` does not take effect HOT 4
- Vercel integration is causing runtime errors in undici integration HOT 9
- Client-side sourceMappingURL is being erased despite of settings HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentry-javascript.