简体   繁体   English

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

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

When running locally, I can run "next build" without problems.在本地运行时,我可以毫无问题地运行“下一个构建”。 The command "vercel build" also works without problems.命令“vercel build”也可以正常工作。 But as soon as I deploy to vercel, the "Linting and checking validity of types" fails when it's being built on vercel.但是,一旦我部署到 vercel,当它在 vercel 上构建时,“Linting 和检查类型的有效性”就会失败。 Typescript is set to strict mode, but it is as if it's even stricter in when running in vercel even though it's the same codebase. Typescript 设置为严格模式,但在 Vercel 中运行时,即使它是相同的代码库,它也好像更加严格。

The app is based on the create-t3 app.该应用程序基于 create-t3 应用程序。 It stops building on vercel as soon as I add a "select" statement in a prisma findUnique query.一旦我在 prisma findUnique 查询中添加“select”语句,它就会停止在 vercel 上构建。 Such as in the "check-credentials" file.比如在“check-credentials”文件中。

In the console in vercel, it would output the following error:在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)) {

I have created a clone of the repository, as my best guess is that there might be a problem with ts validation and linting being ignored locally, but not on deploys: https://github.com/Andreaswt/t3-app我已经创建了存储库的克隆,因为我最好的猜测是 ts 验证和 linting 可能会在本地被忽略,但在部署时不会出现问题: https ://github.com/Andreaswt/t3-app

Looks like an error where your Prisma schema in CI compiles to a different output than whatever your local Prisma schema is compiling to.看起来像一个错误,您的 CI 中的 Prisma 模式编译为与本地 Prisma 模式正在编译的任何输出不同的输出。 I'm unfamiliar with t3, but it seems that you're changing the Prisma schema without also recompiling the underlying Prisma client.我对 t3 不熟悉,但似乎您正在更改 Prisma 架构而没有重新编译底层 Prisma 客户端。 You probably need to run db-generate-client to keep backend functionality in sync with your schema.您可能需要运行db-generate-client以使后端功能与您的架构保持同步。

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

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