rwieruch
Explore posts from serversPPrisma
•Created by rwieruch on 12/20/2024 in #help-and-questions
Transactions across Files
I have the following two calls, one a direct Prisma call and the other one a Service call which does multiple inner Prisma calls.
I found this discussion related to it: https://github.com/prisma/prisma/issues/12975 Is there no way to implement this as a transaction? At least it would be useful to provide a workaround as an example like mentioned over here: https://github.com/prisma/prisma/issues/12975#issuecomment-1426915067
So my guess is that we should use interactive transactions and pass the tx to the service, correct?
https://www.prisma.io/docs/orm/prisma-client/queries/transactions#example
6 replies
PPrisma
•Created by rwieruch on 12/3/2024 in #help-and-questions
Prisma Singleton in Next.js
Hi, I used the Prisma docs (https://www.prisma.io/docs/orm/more/help-and-troubleshooting/help-articles/nextjs-prisma-client-dev-practices) to setup and tested it. In my Next application, I observed the fact that, whenever I navigate between pages, the globalThis is reset, expected one time the Prisma client to be instantiated and used across all the app, but this was not the case.
Am I doing something wrong? Does NextJS initiate Prisma on each page?
Thank you
This is a question I got from one of my students in my new course where I didn't know the definitive answer.
2 replies