#Prisma Optimize doesn't record anything. What am I missing?
12 messages · Page 1 of 1 (latest)
Do you get any errors?
Can you share how you are instantiating Prisma Client with Optimize extension?
Are you using latest version of prisma and optimize extension?
Hi @vivid whale here are the errors:
Import trace for requested module:
./node_modules/@opentelemetry/instrumentation/build/esm/platform/node/instrumentation.js
./node_modules/@opentelemetry/instrumentation/build/esm/platform/node/index.js
./node_modules/@opentelemetry/instrumentation/build/esm/platform/index.js
./node_modules/@opentelemetry/instrumentation/build/esm/index.js
./node_modules/@prisma/extension-optimize/dist/index.js
./src/lib/db.ts
./src/app/(default)/confirm-booking/page.tsx
./node_modules/prisma-instrumentation-5-x/node_modules/@opentelemetry/instrumentation/build/esm/platform/node/instrumentation.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
./node_modules/prisma-instrumentation-5-x/node_modules/@opentelemetry/instrumentation/build/esm/platform/node/instrumentation.js
./node_modules/prisma-instrumentation-5-x/node_modules/@opentelemetry/instrumentation/build/esm/platform/node/index.js
./node_modules/prisma-instrumentation-5-x/node_modules/@opentelemetry/instrumentation/build/esm/platform/index.js
./node_modules/prisma-instrumentation-5-x/node_modules/@opentelemetry/instrumentation/build/esm/index.js
./node_modules/prisma-instrumentation-5-x/dist/chunk-6MQXHI6Y.js
./node_modules/prisma-instrumentation-5-x/dist/index.js
./node_modules/@prisma/extension-optimize/dist/index.js
./src/lib/db.ts
./src/app/(default)/confirm-booking/page.tsx
Here's how I am instantiating prisma client:
`
import { PrismaClient } from "@prisma/client";
import { withOptimize } from "@prisma/extension-optimize";
const globalForPrisma = global as unknown as { prisma: PrismaClient };
function makeClient() {
return new PrismaClient({ log: ["error"] }).$extends(
withOptimize({ apiKey: process.env.OPTIMIZE_API_KEY as string }),
);
}
export const db = globalForPrisma.prisma || makeClient();
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = db;
`
Yes, using the latest version of both
Just a quick question - will recordings only appear if they need to i.e. if they're not already optimised? Or should it be showing every single database query in the Optimize console?
Just realised I had "driverAdapters" set up in my schema.prisma file. Have removed that as we don't use a serverless driver adapter anymore. Will report back on whether or not it fixes this issue.
Okay, after removing driverAdapter from prisma schema and re-running push/generate commands, testing the optimize spans again it still doesn't record anything.
will recordings only appear if they need to i.e. if they're not already optimised? Or should it be showing every single database query in the Optimize console?
You should see all the database queries in Optimize console. It may happen that there are no recommendations, but you still should be able to see the database queries in Optimize console.
When exactly do you get this error? Immediately after staring the app?