PrismaClient is unable to be run in the browser.
See original GitHub issueBug description

Expected behavior
A user authentication page should be displayed.
Prisma information

schema.prisma

Environment & setup
-
OS: windows 10 v1909

-
Database: Heroku postgresql

-
Node.js version: v 15.4.0

-
Prisma version: 2.17.0

Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
PrismaClient is unable to be run in the browser. #6219 - GitHub
Bug description I'm getting an Error: PrismaClient is unable to be run in the browser. How to reproduce Create new Node Project with...
Read more >How to fix the error `PrismaClient is unable to be run in the ...
In that line I called a method from my Prisma instance, which I imported at the top of the page file. Basically Next.js...
Read more >Best practice for instantiating PrismaClient with Next.js
In development, the command next dev clears Node.js cache on run. This in turn initializes a new PrismaClient instance each time due to...
Read more >Server code in *.server.ts getting bundled in Remix JS Client
I am getting an error that says: PrismaClient is unable to be run in the browser. even though PrismaClient is being run inside...
Read more >@prisma/client - npm
Alternatively you can explore the ready-to-run examples (REST, GraphQL, gRPC, plain JavaScript and TypeScript demos, ...) or watch the demo ...
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 Free
Top 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

I’m not sure if anyone is still facing this issue, but I solved it by initializing prisma once and on the server only.
Use
if (typeof window === "undefined") {to run code on the server but not on the browser.There should be a PR for this !