Getting error this.getGlobalTracingHelper(...).dispatchEngineSpans is not a function
Hello!
I just installed the prisma extension optimize, I'm using:
- Node: 20.x
- TypeScript: ^5.5.3
- Express: ^4.19.2
- Prisma: ^6.1.0
- @prisma/client: ^6.1.0
- @prisma/extension-optimize: ^1.1.1
I updated the prisma file to allow this feature like this:
then I updated the prisma client to look like this:
however once I run the app I get this error:
Thanks in advance.
I just installed the prisma extension optimize, I'm using:
- Node: 20.x
- TypeScript: ^5.5.3
- Express: ^4.19.2
- Prisma: ^6.1.0
- @prisma/client: ^6.1.0
- @prisma/extension-optimize: ^1.1.1
I updated the prisma file to allow this feature like this:
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl"]
previewFeatures = ["relationJoins", "tracing"]
}generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl"]
previewFeatures = ["relationJoins", "tracing"]
}then I updated the prisma client to look like this:
import { Prisma, PrismaClient } from '@prisma/client';
import prismaCache from '../utils/prisma-cache';
import { withOptimize } from '@prisma/extension-optimize';
import envConfig from './env.config';
const cacheManager = Prisma.defineExtension((client) => {
return client.$extends({
query: {
$allModels: {
async $allOperations({ model, operation, args, query }) {
const result = await query(args);
prismaCache.cachePrismaUserAllowedCountries(model, operation);
return result;
},
},
},
});
});
const prisma = new PrismaClient()
.$extends(cacheManager)
.$extends(withOptimize({ apiKey: envConfig.OPTIMIZE_API_KEY }));
export default prisma;import { Prisma, PrismaClient } from '@prisma/client';
import prismaCache from '../utils/prisma-cache';
import { withOptimize } from '@prisma/extension-optimize';
import envConfig from './env.config';
const cacheManager = Prisma.defineExtension((client) => {
return client.$extends({
query: {
$allModels: {
async $allOperations({ model, operation, args, query }) {
const result = await query(args);
prismaCache.cachePrismaUserAllowedCountries(model, operation);
return result;
},
},
},
});
});
const prisma = new PrismaClient()
.$extends(cacheManager)
.$extends(withOptimize({ apiKey: envConfig.OPTIMIZE_API_KEY }));
export default prisma;however once I run the app I get this error:
ERROR { 9:15:02 a.m.
"name": "TypeError",
"message": "this.getGlobalTracingHelper(...).dispatchEngineSpans is not a function",
"stack": "TypeError: this.getGlobalTracingHelper(...).dispatchEngineSpans is not a function\n at ho.dispatchEngineSpans (/home/nicotordev/Escritorio/spiritory/backend/node_modules/@prisma/client/runtime/library.js:121:1715)\n at Object.connect (/home/nicotordev/Escritorio/spiritory/backend/node_modules/@prisma/client/runtime/library.js:111:11492)\n at async t (/home/nicotordev/Escritorio/spiritory/backend/node_modules/@prisma/client/runtime/library.js:112:2309)"
} ERROR { 9:15:02 a.m.
"name": "TypeError",
"message": "this.getGlobalTracingHelper(...).dispatchEngineSpans is not a function",
"stack": "TypeError: this.getGlobalTracingHelper(...).dispatchEngineSpans is not a function\n at ho.dispatchEngineSpans (/home/nicotordev/Escritorio/spiritory/backend/node_modules/@prisma/client/runtime/library.js:121:1715)\n at Object.connect (/home/nicotordev/Escritorio/spiritory/backend/node_modules/@prisma/client/runtime/library.js:111:11492)\n at async t (/home/nicotordev/Escritorio/spiritory/backend/node_modules/@prisma/client/runtime/library.js:112:2309)"
}Thanks in advance.


