-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(client): added dynamic context in middleware #13923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
211a9cb
to
079ae0a
Compare
Related: #9759 |
Any update about this feature? |
Any update? Thanks! |
update: #6882 (comment) |
Hey guys, any updates on this?? Really need this feature for my implementation. |
LGTM! |
I apologize for the delay from our side. Client extensions allow to create independent context-specific lightweight prisma client "forks". The pattern for using this: const prisma = new Prisma()
app.get('/some-path', (request) => {
const localPrisma = prisma.$extends(someSessionSpecificExtension(request))
// use localPrisma while handling the request
}) From all extension components, query extensions are conceptually closest to the middlewares and most middlewares should be convertable to query extension. If you encounter any problems with this pattern or it does not fit your usecases, feel free to open an issue. |
Problem
This problem is well described here: #13366
Solution
Creation example:
Use example in middleware: