After adding a prisma client extension it is not possible anymore to define event based logging handlers #23108
Labels
bug/0-unknown
Bug is new, does not have information for reproduction or reproduction could not be confirmed.
domain/client
Issue in the "Client" domain: Prisma Client, Prisma Studio etc.
kind/bug
A reported bug.
topic: clientExtensions
Bug description
It is not possible (since version >=5.0.0) to define a handler for event based logging after adding an extension to the prisma client. The
$on
method is missing and was working in the 4 major release even with extensions.prismaClientWithSomeExtension.$on("query", (event) => queryEvents.push(event));
How to reproduce
Property '$on' does not exist on type 'DynamicClientExtensionThis<TypeMap<InternalArgs & { result: {}; model: {}; query: {}; client: { $begin: () => (txOptions?: TransactionOptions | undefined) => Promise<FlatTransactionClient>; }; }>, TypeMapCb, { ...; }>'.ts(2339)
Expected behavior
The $on method can still be used in order to handle logging events, after adding an extension. This is especially useful when writing integration tests in order to asserting queries, that are running against the database.
Prisma information
You can use any schema, i use:
Tyoescript code reproducing this issue:
Environment & setup
Prisma Version
All versions >=5
The text was updated successfully, but these errors were encountered: