PrismaP
Prisma16mo ago
3 replies
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 Issue with prisma optimize

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


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


Any help with this would be appreciated.
Was this page helpful?