Object literal may only specify known properties, and 'x' does not exist in type (prisma)

Moh*_*ian 2 next.js vercel prisma

Recently I've tried to add two new items to one of my tables in my Prisma schema. After I update my database (using Prisma DB push) and try to .create a new data for my table I face some issues. On my localhost the project is fine and all the APIs are working correctly. but when I deploy the project on the server (using Vercel) it throws an error:

在此输入图像描述

this is my schema : 在此输入图像描述

this is my saveFormData.ts ( the API for saving data ) : 在此输入图像描述

p.s: I'm using next.js + Prisma :

Moh*_*ian 5

我通过在 package.json 文件中添加一些脚本来修复它:

  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "vercel-build": "prisma generate && prisma db push && next build",
    "prisma:generate": "prisma generate"
  },
Run Code Online (Sandbox Code Playgroud)

ps:您可以使用 migrate deployprisma db Push 代替

  • 这救了我。当我部署到 Vercel 时,我遇到了同样的问题。我以前从未发生过这种情况。这是在 vercel 构建时发生的。在验证类型时要具体。它没有检测到我对使用 ```yarn prisma migrate dev --preview-feature``` 更新的 prisma.schema 所做的更改。以前我这样做从来没有遇到过问题,但也许我在此过程中犯了一些错误。 (3认同)