Comments (8)
Hi @JoshuaM1995 have a look at the extensions example which uses $on
with an extended PrismaClient
Extended Prisma Client
nestjs-prisma/examples/extensions/src/prisma.extension.ts
Lines 3 to 13 in 2b93c9e
Use $on
from nestjs-prisma.
I tested the extensions example with the latest prisma version 4.16.1 and I am seeing the same error as you:
src/prisma.extension.ts:25:22 - error TS2339: Property '$on' does not exist on type 'DynamicClientExtensionThis<TypeMap<Args & { result: {}; model: { user: { findByEmail: () => (email: string) => Promise<GetResult<{ id: string; email: string; name: string; }, { [x: string]: () => unknown; }> & {}>; }; }; query: {}; client: {}; }>, TypeMapCb, { ...; }>'.
25 extendedPrismaClient.$on('query', (e) => {});
This might be an issue with the latest prisma version. Either $on
is missing in the types or it is not available any longer for extended PrismaClients.
from nestjs-prisma.
@JoshuaM1995 I found the following issue about disallowing $on
for extended clients: prisma/prisma#19552 (comment)
You can find it also in the release notes from 4.16.0
from nestjs-prisma.
@JoshuaM1995 I found the following issue about disallowing
$on
for extended clients: prisma/prisma#19552 (comment)You can find it also in the release notes from 4.16.0
Thanks for looking into this. Are there any plans for supporting Prisma 4.16.0 any time soon? I can help contribute if possible.
If not I can try downgrading. That was the first thing I tried, but even after downgrading @prisma/client
and prisma
in my package.json files (I'm in a monorepo), I still see it generating the client with 4.16.0. I even tried using npx to generate it with a specific version of the cli, with no luck.
from nestjs-prisma.
Also, maybe it would be safer to lock prisma to a patch version in the package.json? @marcjulian
"@prisma/client": "~4.13.0"
from nestjs-prisma.
Update: I was able to solve this temporarily with PNPM by adding this to my package.json:
"pnpm": {
"overrides": {
"@prisma/client": "4.15.0",
"prisma": "4.15.0"
}
}
from nestjs-prisma.
@JoshuaM1995 I have update it to the latest prisma client and added support for extension GA. Please try it out with the latest dev release:
npm i [email protected]
from nestjs-prisma.
This has been released with 0.21.0
from nestjs-prisma.
Related Issues (20)
- using deprecated package
- Use of $extends HOT 2
- When will nestjs 10 be supported? HOT 2
- use extension instead of middleware HOT 1
- Error: "beforeExit" hook is not applicable to the library engine since Prisma 5.0.0, it is only relevant and implemented for the binary engine. Please add your event listener to the `process` object directly instead. HOT 8
- Options fail with latest nest cli HOT 2
- Prisma 5.0.0 Upgrade HOT 1
- PrismaService generator generates deprecated code HOT 3
- feat: add option to use generic http messages in Prisma exception filter HOT 1
- applicationRef undefined in nest e2e tests HOT 1
- error TS2307: Cannot find module '@nestjs-prisma' or its corresponding type declarations. HOT 1
- Extensions: `create` and `update` broken HOT 1
- Using extension packages (read replica) HOT 7
- Custom Prisma Client is not working HOT 13
- Bump prisma version HOT 2
- Link on `middleware` broken HOT 1
- CustomPrismaService unit testing HOT 2
- Feature Request: add support for using PrismaClientExceptionFilter as a controller/gateway/method level filter
- Possibility to use extensions and this.prisma. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nestjs-prisma.