svirins
PPrisma
•Created by svirins on 8/21/2024 in #help-and-questions
Error: PrismaClient is unable to be run in the browser
Hi all. I have encountered the following problems:
When extending the Prisma client, adding the
$extends
directive causes an application error ‘PrismaClient is unable to be run in the browser.’.
A meaningful part of the stack:
@prisma/[email protected]
@tanstack/[email protected]
@trpc/[email protected]
@trpc/[email protected]
@trpc/[email protected]
[email protected]
[email protected]
I'm using [email protected]
with [email protected]
At first, I thought the problem was related to the way tRPC interacts with Prisma and react-query in queries from the client. But, it turns out that just adding another Prisma client with the directive $extends
is enough to cause the error. Even if it's not being used anywhere in the app code.
The application builds successfully, but when I run it in the browser console I see:
Error: PrismaClient is unable to run in this browser environment, or has been bundled for the browser (running in unknown).
I would be very grateful if you could share your insights and ways to solve this problem6 replies