Issue with Prisma Optimize: UI Waiting for Queries

Code Setup
...

generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "debian-openssl-1.1.x"]
previewFeatures = ["tracing", "relationJoins"]
}

...
...

generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "debian-openssl-1.1.x"]
previewFeatures = ["tracing", "relationJoins"]
}

...
import { PrismaClient } from '@prisma/client';
import { withOptimize } from '@prisma/extension-optimize';

...

const prismaClient = new PrismaClient({
datasources: {
db: {
url: getConnectionUrl(), // Function that returns the database connection URL
},
},
}).$extends(
withOptimize({ apiKey: process.env.PRISMA_OPTIMIZE_API_KEY ?? '' }),
) as PrismaClient;
import { PrismaClient } from '@prisma/client';
import { withOptimize } from '@prisma/extension-optimize';

...

const prismaClient = new PrismaClient({
datasources: {
db: {
url: getConnectionUrl(), // Function that returns the database connection URL
},
},
}).$extends(
withOptimize({ apiKey: process.env.PRISMA_OPTIMIZE_API_KEY ?? '' }),
) as PrismaClient;
Observed Behavior When starting the server, the following message is logged:
┌─────────────────────────────────┐
See your Optimize dashboard at: │
https://optimize.prisma.io │
└─────────────────────────────────┘
┌─────────────────────────────────┐
See your Optimize dashboard at: │
https://optimize.prisma.io │
└─────────────────────────────────┘
However, the Optimize UI shows “waiting for queries,” and queries do not appear on the dashboard. We are not using NestJS, as suggested in similar issues. Versions - @prisma/client: v5.22.0 - @prisma/extension-optimize: v1.1.4 - Node.js: v22.12.0 Debugging Steps Taken 1. Validated API Key: Logged PRISMA_OPTIMIZE_API_KEY to ensure it’s correct. 2. Checked Prisma Logs: Here are the logs from the libraryEngine:
prisma:client:libraryEngine internalSetup +1ms
prisma:client:libraryEngine internalSetup +1ms
prisma:client:libraryEngine sending request, this.libraryStarted: false +0ms
prisma:client:libraryEngine library starting +0ms
prisma:client:libraryEngine library started +888ms
prisma:client:libraryEngine internalSetup +1ms
prisma:client:libraryEngine internalSetup +1ms
prisma:client:libraryEngine sending request, this.libraryStarted: false +0ms
prisma:client:libraryEngine library starting +0ms
prisma:client:libraryEngine library started +888ms
Questions - Are there additional configurations or prerequisites we might be missing for withOptimize? - Could the issue stem from compatibility between @prisma/client and @prisma/extension-optimize versions? - Are there any known issues with Node.js v22.12.0 affecting @prisma/extension-optimize? Any insights or suggestions are appreciated! 🚀
No description
2 Replies
Nurul
Nurul4d ago
Hi @Zino (Expatfile.tax) 👋 Can you try with latest prisma release i.e. v6.1.0 and optimize extension version v1.1.4 and check if you are getting the same behaviour? Once you are using Prisma v6.1.0, you can also remove tracing from previewFeatures
Zino (Expatfile.tax)
Hi @Nurul 👋 Unfortunately, we cannot upgrade to Prisma v6 yet, as it is currently incompatible with Sentry due to this issue: https://github.com/getsentry/sentry-javascript/issues/14793 We’re on the latest v5 release of Prisma (v5.22.0), which, based on the documentation, should be compatible with Prisma Optimize. Could you confirm if there are any additional steps or configurations required for it to work properly in this version? Thanks for your help!
GitHub
Support Prisma v6 · Issue #14793 · getsentry/sentry-javascript
Description From: getsentry/sentry-docs#12184 Prisma launched new version of 6.1.0 where tracing is not in previewFeature and some additional things need to be done to be able to trace application....

Did you find this page helpful?