Vercel with Prisma in a Turborepo deploy
Answered
Gaëtan H posted this in #help-forum
Gaëtan HOP
I've been trying to correct this problem for a good day now. Without success
I've tested everything I've seen on Github, what's been suggested via AIs etc. Nothing fixes this problem.
I have deployed the prisma & turbo template they provide and it magically deploys without a hitch and I have no errors in the logs.
I don't understand
Does anyone have an idea?
I've tested everything I've seen on Github, what's been suggested via AIs etc. Nothing fixes this problem.
I have deployed the prisma & turbo template they provide and it magically deploys without a hitch and I have no errors in the logs.
I don't understand
Does anyone have an idea?
{
"$schema": "https://turbo.build/schema.json",
"ui": "tui",
"tasks": {
"build": {
"dependsOn": ["^build", "^db:generate"],
"inputs": ["$TURBO_DEFAULT$", ".env*"],
"outputs": ["dist/**", ".next/**", "!.next/cache/**"],
"scripts": {
"db:generate": "npx prisma generate --schema ./prisma",
"db:migrate": "npx prisma migrate dev --skip-generate",
"db:deploy": "npx prisma migrate deploy"
},
Answered by Eulophid wasp
You could try removing any prisma stuff out of your root package.json?
53 Replies
Eulophid wasp
Same issue here, seems to be a known issue and Prisma (from what I can tell) is silent on it. The problem is the custom output path, if you remove that and export from
See: https://www.answeroverflow.com/m/1361918134927229039
@prisma/client
instead it works (albeit with your console being flooded with Package @prisma/client can't be external
warnings). The thing is that Prisma 7 will require custom output paths, so this is a temporary hack fix to get things running at bestSee: https://www.answeroverflow.com/m/1361918134927229039
Extremely frustrating and I've wasted half a day on it myself, I loved Prisma initially but these kinds of problems keep popping up and I wish I went with a different ORM at this point but it's too late to switch
Eulophid wasp
Modify your
schema.prisma
to remove everything from generator client
except provider
. Next, modify your index.ts/client.ts and change all instances of ../generated/prisma
to @prisma/client
. Next, add public-hoist-pattern[]=*prisma*
to your .npmrc
. Finally, run pnpm install
and pnpm db:generate
This is a stupid fix because custom output will be required for prisma 7 anwyays, but it will get things running for now
I'm not wasting any more time on this 

(See also: https://github.com/prisma/prisma/issues/22142)
@Eulophid wasp Modify your `schema.prisma` to remove everything from `generator client` except `provider`. Next, modify your index.ts/client.ts and change all instances of `../generated/prisma` to `@prisma/client`. Next, add `public-hoist-pattern[]=*prisma*` to your `.npmrc`. Finally, run `pnpm install` and `pnpm db:generate`
Gaëtan HOP
Uhm, i used to be able to use the enums from my prisma by importing them.
Is this no longer possible?
Is this no longer possible?
my files:
@Gaëtan H Uhm, i used to be able to use the enums from my prisma by importing them.
Is this no longer possible?
Eulophid wasp
It needs to be
export * from '@prisma/client'
instead of ./client
e.g.
export {prisma} from "./client";
export * from "@prisma/client";
export type {JsonObject, JsonArray} from "@prisma/client/runtime/library";
If you want check my setup https://github.com/Steellgold/simplist
@Gaëtan H <@194963661670842368> always the problem...
Eulophid wasp
If your root directory is a sub-package, try this
Essentially running the commands at the root instead of in a subdirectory
e.g. if you have something like this configured
Eulophid wasp
Yeah so you would have to
cd ../../
try that
I also don't have
@prisma/client
or prisma
defined in my dependencies in the root package.json, you could try thatIt should hoist them from your
packages/database
@Gaëtan H like that?
Eulophid wasp
The filter in your case would have to be
apps/auth
I believeEulophid wasp
The postinstall script automatically ran
prisma generate
, which failed.I'm not sure if any of this matters, I'm just comparing our code. I don't have a postinstall script for Prisma, and using
npx
instead of just running prisma generate
might be an issue?You shouldn't need it seeing as running either build or dev will also run db:generate
Gaëtan HOP
I'm going to try this
Eulophid wasp
But those postinstall errors are odd
Eulophid wasp
That definetly looks better
Oh
Is this running with servless functions?
Actually I think now I'm confused
That should be fine
Eulophid wasp
Only reason I bring it up is because my error was
query-engine-rhel-openssl-3.0.x
whereas your is query-engine-rhel-openssl-3.0.x.so.node
@Gaëtan H I do believe that yes ?
Eulophid wasp
That's fine, I have fluid compute enabled as well
Eulophid wasp
You could try removing any prisma stuff out of your root package.json?
Answer
Eulophid wasp
That
.so.node
is the only difference in the error messagefrom mine
@Eulophid wasp You could try removing any prisma stuff out of your root package.json?
Gaëtan HOP
That's what I took from the turbopack with prisma example. Which I managed to deploy without any problems
but i trying this
oh my fucking god
No red errors
Eulophid wasp
Is it working?
Gaëtan HOP
Yes, it works. The only errors I have are related to authentication, I misconfigured the URL callbakc, but otherwise it works.
Thanks a lot!
Thanks a lot!
Eulophid wasp
No worries, glad it works!
I'd leave this thread open as the root issue still isn't solved, something wrong with Prisma/Vercel with custom output
Gaëtan HOP
Yes totally