Hi everyone. I would really like to try Optimize, and have been trying for some time. See similar discussion here #1270167207204356178 message
But it does not record anything. There is not a single log. No "errors" logs, no "success" logs. I don't know what's going on. Did Optimize initialize successfully ? Did it error ?
Again, using NestJS. Here is current non-working code :
import { Inject, Injectable } from "@nestjs/common";
import type { ConfigType } from "@nestjs/config";
import { PrismaClient } from "@prisma/client";
import { withOptimize } from "@prisma/extension-optimize";
import appConfig, { appConfigFeature } from "../config/app.config";
@Injectable()
export class PrismaService extends PrismaClient {
constructor(
@Inject(appConfigFeature.KEY)
private readonly appConfiguration: ConfigType<typeof appConfig>,
) {
super();
this.$extends(withOptimize({
apiKey: this.appConfiguration.PRISMA_OPTIMIZE_KEY,
}))
try {
if (
this.appConfiguration.NODE_ENV === "production" ||
this.appConfiguration.NODE_ENV === "development"
) {
const extendedClient = this.$extends(withOptimize({
apiKey: this.appConfiguration.PRISMA_OPTIMIZE_KEY,
}));
Object.assign(this, extendedClient);
}
this.user.findMany()
} catch (error) {
console.error(error)
}
}
Is there a method to know which middlewares have been added ? like this.prisma.listActiveMiddlewares() or something ? So that I could troubleshoot, debug, try things to know where the problem comes from ? Like does it come from my implementation or from Prisma, or from the Class ?
Cheers.