I'm using Prisma and Vercel. Prisma dynamically generates the Prisma client, but Vercel caches the old client and doesn't rebuild it unless I log in to Vercel and click "redeploy" which forces it to reinstall all the packages.
Is there any way to force this one package to just rebuild every time I push to GitHub, so that Vercel won't use the cached version? I noticed that if I change the package version, it will rebuild, but that's a pretty big hack. Is there some way to flag it to rebuild every time?
"@prisma/client": "3.8.0" // some special flag to prevent this from getting cached?
I'm using Prisma and Vercel. Prisma dynamically generates the Prisma client, but Vercel caches the old client and doesn't rebuild it unless I log in to Vercel and click "redeploy" which forces it to reinstall all the packages.
Is there any way to force this one package to just rebuild every time I push to GitHub, so that Vercel won't use the cached version? I noticed that if I change the package version, it will rebuild, but that's a pretty big hack. Is there some way to flag it to rebuild every time?
"@prisma/client": "3.8.0" // some special flag to prevent this from getting cached?
Share
Improve this question
asked Jan 17, 2022 at 17:12
GlennGlenn
5,0519 gold badges38 silver badges48 bronze badges
2 Answers
Reset to default 24What command are you using to build the app?
Recommended approach is to use this one:
// package.json scripts section
"vercel-build": "prisma generate && prisma migrate deploy && next build",
It will generate new prisma client and definitions, apply migrations and then build the app for production.
More info in the docs as always
"scripts" {
"postinstall": "prisma generate"
}
generator client {
provider = "prisma-client-js"
}
https://www.prisma.io/docs/orm/prisma-client/deployment/serverless/deploy-to-vercel