PrismaP
Prisma13mo ago
6 replies
Zino (Expatfile.tax)

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"]
}

...


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      │
└─────────────────────────────────┘

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


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! 🚀
Screenshot_2025-01-03_at_11.06.46.png
Was this page helpful?