Still unable to get Optimize working in my NestJS app.
Hi everyone. I would really like to try Optimize, and have been trying for some time. See similar discussion here https://discord.com/channels/937751382725886062/1270167207204356178/1275034014025121792
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 :
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.7 Replies
Hey @Virgile!
I was able to reproduce this issue with a NestJS project and have already reported it to Optimize team.
Here's a related thread where I shared the reproduction:
https://discord.com/channels/937751382725886062/1288624617165946943/1288624617165946943
I'll provide you with an update this week with next steps. If it's a bug with Optimize, then we will work on fixing it. If it's not a bug, we will update the documentation with steps on using Optimize with NestJS.
Thank you for your patience and assistance while we work on finding the solution 🙏
@Virgile We were able to make Optimize work with Optimize. Can you instantiate PrismaClient in
OnModuleInit
like this:
https://github.com/nurul3101/Optimize-NestJS/blob/main/src/prisma.service.ts
This would make sure that queries are displayed in Optimize Dashboard.
@Virgile Just checking if you had a chance to try out the suggested solution. Let us know in case you still observe any issues.Hey, I'm trying to instantiate it like this due to typescript typings but still no luck
I'm on a monorepo if that helps
What happens if you temporarily remove the pagination extension and only use the optimize one. Do you still see no queries in optimize dashboard?
@Nurul (Prisma) I have also facing the same issue on my backend, I am using Nest.js, Prisma and swagger.
This is my databaseService code
I'm getting the log that
see your optimize dashboard
but not getting anything in the prisma optimize dashboard when running the api's in the swagger.@Anubhav@12 Do you mind sharing link to your repository?
I would like to share it with our Optimize team
Its a private repo but i will try to make a reproducible example of this repo in a public repo then i will share the link
That would be very helpful 🙏