sentry-javascript: Prisma Tracer not working on production builds
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? If you use the CDN bundles, please specify the exact bundle (e.g. bundle.tracing.min.js) in your SDK setup.
SDK Version
7.37.2
Framework Version
13.1.1
Link to Sentry event
SDK Setup
Sentry.init({
environment: env.NEXT_PUBLIC_APP_ENV,
dsn: env.NEXT_PUBLIC_SENTRY_DSN,
tracesSampleRate: 1.0,
profilesSampleRate: 1.0,
integrations: [
new CaptureConsole({
levels: ['log', 'warn', 'error', 'debug', 'assert'],
}),
new Tracing.Integrations.Prisma({ client: prisma }),
new ProfilingIntegration(),
],
});
Steps to Reproduce
For context, this is being run within an NX monorepo.
Steps:
- Build production build:
nx build app(application is called app) - Execute production build:
nx run app:serve:production - Open the application in a page that has any tRPC API call with database use.
Expected Result
Profiling contains prisma database spans.
Actual Result
No database spans are present. However the interesting thing is that if I were to execute the application in development mode, the spans are reported correctly. This issue started happening when we upgraded the following packages:
"@sentry/nextjs": "^7.28.1" -> "^7.37.2",
"@sentry/profiling-node": "^0.0.12" -> "^7.37.2",
"@sentry/replay": "^7.28.1" -> "^7.37.2",
"@sentry/tracing": "^7.28.1" -> "^7.37.2",
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 2
- Comments: 16 (7 by maintainers)
@ThallesP Yes I looked into it and it is currently not possible to have a proper tracer that uses the client extension as it breaks out of async context. Luckily we will soon have full OTEL support so this is gonna be solved by that.
We’ve thought about adding manual instrumentation to prisma, but given that it was working without any issues before, we’d rather help surface this than going the “manual route”.
I recently noticed something similar going on in a test app of mine. I investigated a bit but couldn’t get to the root cause yet. What I found though is that manually instrumenting prisma in
sentry.server.config.jsseems to work: