Optimize + NestJS not working
GM, I checked the whole forum before asking
I tried to test with the provided example :
https://github.com/nurul3101/Optimize-NestJS/tree/main
But without success.
This is how we are instantiating our prisma service :
We use some multiSchema and prismaSchemaFolder dunno if it can interfere
On nestjs :
This is used to create a typed Extended Instance of the prisma client
Then we use the prisma.service exported by the prisma.module :
The super must create an instance of extended client with extension (it work for pulse not for optimize by the way)
and the return if instance exist is too prevent opening too much connection
Happy to provide more code if it can help let me know, feel free to ping me
GitHub
GitHub - nurul3101/Optimize-NestJS
Contribute to nurul3101/Optimize-NestJS development by creating an account on GitHub.
4 Replies
While optimize doesn't work on nestjs, I did a rapid tool to parse a full nestjs API and with CLI command line run prisma queries to use optimize outside my API let me know if you want to have this as an example
It parse every controller and do smth like this :
@SoxZz5 To confirm, you cloned the code from this example and it didn't work for you?
https://github.com/nurul3101/Optimize-NestJS/tree/main
One other user reported the same intially, but it worked for them eventually.
https://github.com/nurul3101/Optimize-NestJS/issues/2
Didn't cloned it, but I checked the package json, the .prisma, and how you register the service it was really near the way we do it (we just type it a bit more)
So then what I did sicne it's not working with our NestJS, I did a little tool to get all endpoints -> service -> prisma call
And recreate it (my second screenshot) so now optimize work in the context of my little tool it's a simple nodeJS, but we still don't get prisma with optimize working on NestJS (pulse seems to work and we will try accelerate)
@kipit ( I just tag one other dev on the project so he can follow too)