P
Prisma2w ago
Rapsil

Prisma Optimize 1.0.1 errors

Hi all, I am having some trouble setting up prisma optimize. I've tried solutions presented in this thread https://discord.com/channels/937751382725886062/1270167207204356178/1270167207204356178 but I have yet to get it up and running. I am repeatedly getting this error
Error: prisma:client:operation span is expected to be entered in the client extension when tracing is enabled
Error: prisma:client:operation span is expected to be entered in the client extension when tracing is enabled
import { PrismaClient } from '@prisma/client';
import { withOptimize } from '@prisma/extension-optimize';

const globalForPrisma = globalThis as unknown as { prisma: PrismaClient };

const prisma =
globalForPrisma.prisma || new PrismaClient().$extends(withOptimize({ apiKey: process.env.OPTIMIZE_KEY! }));

if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;

export const db = prisma;
import { PrismaClient } from '@prisma/client';
import { withOptimize } from '@prisma/extension-optimize';

const globalForPrisma = globalThis as unknown as { prisma: PrismaClient };

const prisma =
globalForPrisma.prisma || new PrismaClient().$extends(withOptimize({ apiKey: process.env.OPTIMIZE_KEY! }));

if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;

export const db = prisma;
I am using the following package versions
@prisma/client: 5.20.0
@prisma/extension-optimize: 1.0.1
@prisma/client: 5.20.0
@prisma/extension-optimize: 1.0.1
Any help with this would be appreciated.
3 Replies
Nurul
Nurul7d ago
Hey @Andrew 👋 Is your repository in which you are trying Optimize open source? If yes, can you share the link to repository so that we can try to run it and reproduce the error?
Rapsil
Rapsil7d ago
Hey @Nurul (Prisma), thanks for replying! It is not open source, but I'm going to try and reproduce it in a minimal project and link it here.
Nurul
Nurul4d ago
That would be amazing! 🙏
Want results from more Discord servers?
Add your server