繁体   English   中英

Vercel:“检查和检查类型的有效性”在部署时失败,但在本地通过

[英]Vercel: "Linting and checking validity of types" fails on deploy but passes locally

在本地运行时,我可以毫无问题地运行“下一个构建”。 命令“vercel build”也可以正常工作。 但是,一旦我部署到 vercel,当它在 vercel 上构建时,“Linting 和检查类型的有效性”就会失败。 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)) {

我已经创建了存储库的克隆,因为我最好的猜测是 ts 验证和 linting 可能会在本地被忽略,但在部署时不会出现问题: https ://github.com/Andreaswt/t3-app

看起来像一个错误,您的 CI 中的 Prisma 模式编译为与本地 Prisma 模式正在编译的任何输出不同的输出。 我对 t3 不熟悉,但似乎您正在更改 Prisma 架构而没有重新编译底层 Prisma 客户端。 您可能需要运行db-generate-client以使后端功能与您的架构保持同步。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM