_patatinabollente
_patatinabollente
PPrisma
Created by samuelcole on 9/10/2024 in #help-and-questions
Optimize is not showing queries
Hi, I have followed the instruction so
npm install @prisma/client@latest @prisma/extension-optimize@latest
npm install --save-dev prisma@latest
npm install @prisma/client@latest @prisma/extension-optimize@latest
npm install --save-dev prisma@latest
Here is my prisma schema
generator client {
provider = "prisma-client-js"
previewFeatures = ["tracing"]
binaryTargets = ["native", "linux-musl"]
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["tracing"]
binaryTargets = ["native", "linux-musl"]
}
Then I extended my prisma client
const customPrismaClient = new PrismaClient().$extends(
withOptimize({
apiKey
})
);

@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
async onModuleInit(): Promise<void> {
Object.assign(this, customPrismaClient);
await this.$connect();
}
}
const customPrismaClient = new PrismaClient().$extends(
withOptimize({
apiKey
})
);

@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
async onModuleInit(): Promise<void> {
Object.assign(this, customPrismaClient);
await this.$connect();
}
}
I think the issue could be this extension on Nest js but I've tried all the examples on https://github.com/prisma/prisma/issues/18628 and nothing seems to work for me. The related issue is relative to maintaining type safety while extending prisma client. I do not think is necessary in this case. For context i am using nest 9 (tried also with 10, no difference) and node 18 (also here tried with 20 no difference) Hope it helps Thanks
43 replies
PPrisma
Created by samuelcole on 9/10/2024 in #help-and-questions
Optimize is not showing queries
Same issue here, I am using Nest js. Maybe it has something to do with extension initialization in my case
43 replies