最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to deploy to Vercel with dynamically generated package from Prisma - Stack Overflow

programmeradmin3浏览0评论

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
Add a comment  | 

2 Answers 2

Reset to default 24

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

"scripts" {
    "postinstall": "prisma generate"
  }

generator client {
  provider = "prisma-client-js"
}

https://www.prisma.io/docs/orm/prisma-client/deployment/serverless/deploy-to-vercel

发布评论

评论列表(0)

  1. 暂无评论