prisma icon indicating copy to clipboard operation
prisma copied to clipboard

PrismaClient is unable to be run in the browser although I'm not trying to

Open Skryvvara opened this issue 4 years ago • 4 comments

I'm getting a prisma error saying "PrismaClient is unable to be run in the browser" although I'm 99.99% sure I'm not trying to. I shouldn't have any piece of code that is supposed to run on the client.

I looked into every file multiple times and couldn't find the culprit. Can anyone help me with this?

repo: https://github.com/xDarkyne/canwecoop

how to reproduce: simply run yarn dev and navigate to localhost:3000 and you'll get the error (you need postgresql (docker included) and run npx prisma generate and npx prisma db push)

Skryvvara avatar Jan 21 '22 20:01 Skryvvara

Repository does not exist.

janpio avatar Jan 21 '22 20:01 janpio

Repository does not exist.

Sorry changed the visibility to public

Skryvvara avatar Jan 21 '22 20:01 Skryvvara

@janpio Solved the issue. Problem was a index.ts file looking like this

export * from './file1';
export * from './file2';
export * from './file3';
export * from './file4';
export { default as prisma } from './prisma';

so when importing anything exported from file 1-4 I got the error that prisma isn't able to to run in the browser. After removing the index file and only importing code from their respective files I didnt get this error anymore

Skryvvara avatar Jan 26 '22 07:01 Skryvvara

Same here. I am calling prisma in a .server file on Remix, but it is returning this same error.

euchicosousa avatar Jan 30 '22 18:01 euchicosousa