Brendonovich / prisma-client-rust

Type-safe database access for Rust
https://prisma.brendonovich.dev
Apache License 2.0
1.76k stars 104 forks source link

Prisma generate not working in Next.js repo #301

Closed timurguvenkaya closed 1 year ago

timurguvenkaya commented 1 year ago

I'm trying to migrate my Next.js app from JS Vercel serverless to Rust serverless functions. I integrated Rust vercel serverless runtime and now I'm trying to integrate rust prisma client. However, when I do cargo prisma generate I get:

Generator at MY_PATH/webapp/node_modules/@prisma/client/generator-build/index.js could not start:

node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module 'MY_PATH/webapp/backend/--max-old-space-size=8096' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function._resolveFilename (pkg/prelude/bootstrap.js:1955:46) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Function.runMain (pkg/prelude/bootstrap.js:1983:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

I tried both installing cli using /bin and workspaces method. None of them worked. I already have JS prisma client integrated, can it be an issue?

timurguvenkaya commented 1 year ago

Found my mistake :) Apologies

merlindru commented 1 year ago

Running into this as well. How did you fix it?

Edit: Fixed by changing the generator provider in my schema.prisma:

generator client {
  provider = "cargo prisma" // NOT prisma-client-js
}