Rapsil
Rapsil
PPrisma
Created by Rapsil on 10/10/2024 in #help-and-questions
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.
4 replies