Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to deploy to Vercel with dynamically generated package from Prisma

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

What 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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading