Open
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.0.0
Framework Version
express@^4.18.1, @nx/express": "18.2.2
Link to Sentry event
No response
SDK Setup
// main.ts
import * as Sentry from "@sentry/node";
import { nodeProfilingIntegration } from "@sentry/profiling-node";
Sentry.init({
serverName: "auth-service",
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV,
enabled: true,
debug: process.env.NODE_ENV !== "production",
integrations: [Sentry.httpIntegration(), Sentry.expressIntegration(), nodeProfilingIntegration()],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
beforeSend(event, hint) {
const error = hint.originalException as Error;
if (error?.message?.match(/database unavailable/i)) {
event.fingerprint = ["database-unavailable"];
}
// Modify or drop the event here
if (event.user) {
// Don't send user's email address
event.user.email = undefined;
}
return event;
},
// Called for transaction events
beforeSendTransaction(event) {
// Modify or drop the event here
if (event.transaction === "/unimportant/route") {
// Don't send the event to Sentry
return null;
}
return event;
},
beforeBreadcrumb(breadcrumb, hint) {
// Check if the breadcrumb has sensitive data like user email
if (breadcrumb.data?.["user"]?.email) {
// Remove the user email from the breadcrumb
breadcrumb.data["user"].email = undefined;
}
return breadcrumb;
},
includeLocalVariables: true,
attachStacktrace: true,
});
/// rest of the app
Steps to Reproduce
- install NX
- Install NX's express
- run nx run --target=serve
I did right as you suggested it in your docs. Imprted and initialised Sentry first thing first. But still, it's not working
Expected Result
Do not have [Sentry] Express is not instrumented. This is likely because you required/imported express before calling Sentry.init()
message, and
Actual Result
Having error message: [Sentry] Express is not instrumented. This is likely because you required/imported express before calling Sentry.init()
message, and
Metadata
Assignees
Type
Projects
Status
No status
Activity