Argument of type '"query"' is not assignable to parameter of type '"beforeExit"'.
See original GitHub issueBug description
Following the documentation to setup custom logging here https://www.prisma.io/docs/concepts/components/prisma-client/working-with-prismaclient/logging
I used:
prisma.$on('query', (e: Prisma.QueryEvent) => {
console.log('Query: ' + e.query)
console.log('Params: ' + e.params)
console.log('Duration: ' + e.duration + 'ms')
})
but this gives the following ts error:
Argument of type '"query"' is not assignable to parameter of type '"beforeExit"'.ts(2345)
How to reproduce
Setup logging as mentioned above as per the docs.
Expected behavior
No response
Prisma information
// Add your schema.prisma
// Add your code using Prisma Client
Environment & setup
- OS: macOS
- Database: SQLite
- Node.js version: v18.4.0
Prisma Version
❯ npx prisma -v
Environment variables loaded from .env
prisma : 4.5.0
@prisma/client : 4.5.0
Current platform : darwin
Query Engine (Node-API) : libquery-engine 0362da9eebca54d94c8ef5edd3b2e90af99ba452 (at node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine : migration-engine-cli 0362da9eebca54d94c8ef5edd3b2e90af99ba452 (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 0362da9eebca54d94c8ef5edd3b2e90af99ba452 (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary : prisma-fmt 0362da9eebca54d94c8ef5edd3b2e90af99ba452 (at node_modules/@prisma/engines/prisma-fmt-darwin)
Format Wasm : @prisma/prisma-fmt-wasm 4.5.0-43.0362da9eebca54d94c8ef5edd3b2e90af99ba452
Default Engines Hash : 0362da9eebca54d94c8ef5edd3b2e90af99ba452
Studio : 0.476.0
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
$on argument type error when extending prisma client #11986
The code above produces the following error: TS2345: Argument of type '"query"' is not assignable to parameter of type '"beforeExit"'.
Read more >Logging with Prisma 2 and NestJS - Dependency Injection ...
Currently on my first NestJS project. I am using Prisma 2, and would like to log the queries to the console in debug...
Read more >prisma is not assignable to type - You.com | The AI Search ...
A simple update query inside the transaction gives me an error: Argument of type '() => Promise<Integration>' is not assignable to parameter of...
Read more >[Community help wanted!] TypeScript Feedback v0.33+
Do you find it helpful that the generated graphql types are not ... Argument of type '"query"' is not assignable to parameter of...
Read more >Argument Type not assignable to Parameter Type Variables
I'm passing an object of arguments into the graphcool api and am getting this: Argument type {tag: string, from: string, to: [string], ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@marceloverdijk I’ve managed do fix this with the following:
That’s because in the type declaration of the PrismaClient, the first type argument is actually the client options. The second one refer to the logging attributes.
Hi @SevInf I just tried it on my project but unfortunately it does not help…
Changing the global declaration to:
gives now:
Type '"query"' has no properties in common with type 'PrismaClientOptions'.ts(2559)