prisma: `parentTracer.getSpanLimits is not a function`
Bug description
Upgrading to Prisma v5.4.1 caused the following error to appear
TypeError: parentTracer.getSpanLimits is not a function
at new Span (/var/task/node_modules/@prisma/instrumentation/node_modules/@opentelemetry/sdk-trace-base/build/src/Span.js:59:41)
at /var/task/node_modules/@prisma/instrumentation/dist/ActiveTracingHelper.js:59:20
at Array.forEach (<anonymous>)
at ActiveTracingHelper.createEngineSpan (/var/task/node_modules/@prisma/instrumentation/dist/ActiveTracingHelper.js:44:27)
at Wi.createEngineSpan (/var/task/node_modules/@prisma/client/runtime/library.js:123:1687)
at dr.propagateResponseExtensions (/var/task/node_modules/@prisma/client/runtime/library.js:112:4691)
at Object.callback (/var/task/node_modules/@prisma/client/runtime/library.js:112:6604)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at dr.withRetry (/var/task/node_modules/@prisma/client/runtime/library.js:112:8713)
at Object.singleLoader (/var/task/node_modules/@prisma/client/runtime/library.js:123:5333) {
clientVersion: '5.4.1'
}
Before the upgrade, everything was running smoothly and the only change was upgrading Prisma
How to reproduce
- Upgrade to Prisma v5.4.1 (you must have open telemetry configured too
Expected behavior
No response
Prisma information
"@prisma/client": "^5.4.1",
"@prisma/instrumentation": "^5.4.1",
"prisma": "^5.4.1"
Environment & setup
- OS: macOs
- Database: PostgreSQL
- Node.js version: 18
Prisma Version
8.11.0
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 10
- Comments: 18 (6 by maintainers)
Is there any update on this? I am running into the same issue.
@aqrln I think we were missing
@opentelemetry/apifrom our deps - adding that fixed the issue, thank you!That dependency is missing in the documentation. Would be great if you could add that.
I just now faced the same problem in one of my local test projects, updating all OpenTelemetry packages fixed this.
Seems like one of dependency updates in
@prisma/instrumentationcaused this. I think we should make@opentelemetry/apiand otherpeerDependenciesand notdependenciesto prevent issues like this.IMO this shouldn’t be relegated to documentation but should be fixed so that the problem does not occur in the first place (or so that the package manager tells you what to install if anything needs to be installed manually, and detects conflicts). I haven’t looked into it, but it sounds like we are bundling OpenTelemetry dependencies while we should probably be using peer dependencies instead.
There’s another issue that I recently saw (https://github.com/prisma/prisma/issues/21473), let’s use that as the main one.
As for https://www.prisma.io/docs/orm/prisma-client/observability-and-logging/opentelemetry-tracing#step-3-install-opentelemetry-packages, it is possible that we should add
@opentelemetry/apithere, but optimally it shouldn’t be the case since it’s not explicitly used or imported in the example. We should investigate and figure out.@aqrln actually which version of
@opentelemetry/apidid you install to fix the issue?Actually we don’t, we use Jaeger (
OTLPTraceExporter)Our code is something like