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
A meaningful part of the stack:
I'm using
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
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 problem
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/client@5.18.0@tanstack/react-query@5.52.0@trpc/client@11.0.0-rc.477@trpc/react-query@11.0.0-rc.477@trpc/server@11.0.0-rc.477next@14.2.5prisma-extension-pg-trgm@1.1.0I'm using
pnpm@9.6.0 with node@20.15.0 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 problem