And*_*sWT 3 typescript next.js vercel prisma
在本地运行时,我可以毫无问题地运行“下一个构建”。命令“vercel build”也可以正常工作。但是,一旦我部署到 vercel,当它构建在 vercel 上时,“类型的检查和检查有效性”就会失败。Typescript 设置为严格模式,但在 Vercel 中运行时似乎更加严格,即使它是相同的代码库。
该应用程序基于 create-t3 应用程序。一旦我在 prisma findUnique 查询中添加“select”语句,它就会停止在 vercel 上构建。例如在“check-credentials”文件中。
在vercel的控制台中,会输出以下错误:
info - Linting and checking validity of types...
Failed to compile.
./src/pages/api/user/check-credentials.ts:33:7
Type error: Type '{ id: true; name: true; email: true; image: true; password: true; }' is not assignable to type 'UserSelect'.
Object literal may only specify known properties, and 'password' does not exist in type 'UserSelect'.
31 | email: true,
32 | image: true,
> 33 | password: true,
| ^
34 | },
35 | });
36 | if (user && user.password == hashPassword(req.body.password)) {
Run Code Online (Sandbox Code Playgroud)
我创建了存储库的克隆,因为我最好的猜测是,ts 验证和 linting 可能在本地被忽略,但在部署时却没有问题: https: //github.com/Andreaswt/t3-app
看起来像是一个错误,CI 中的 Prisma 架构编译为与本地 Prisma 架构编译为不同的输出。我不熟悉 t3,但似乎您正在更改 Prisma 架构,而无需重新编译底层 Prisma 客户端。您可能需要运行db-generate-client以使后端功能与您的架构保持同步。
| 归档时间: |
|
| 查看次数: |
4274 次 |
| 最近记录: |