next.js `prisma.job.findMany()`调用无效:使用SQL Lite连接到Vercel上的数据库时出现数据库路径错误

tjrkku2a  于 2023-06-22  发布在  其他
关注(0)|答案(1)|浏览(181)

我在尝试访问一个加载我的next.js应用程序数据的页面时,遇到了504内部服务器错误。错误状态:

Error retrieving users: PrismaClientInitializationError: 
Invalid `prisma.job.findMany()` invocation:

Error querying the database: unable to open database file:

据我所知,这是没有打开数据库,我不确定它是否是路径。在本地,该路径正在工作并且运行良好。我正在使用Prisma连接到数据库。
我该怎么解决这个问题?
这是vercel日志上的完整错误:

Error retrieving users: PrismaClientInitializationError: 
Invalid `prisma.job.findMany()` invocation:

Error querying the database: unable to open database file: /var/task/node_modules/.prisma/client/../database/invensisdb.db
    at An.handleRequestError (/var/task/node_modules/@prisma/client/runtime/library.js:174:7205)
    at An.handleAndLogRequestError (/var/task/node_modules/@prisma/client/runtime/library.js:174:6358)
    at /var/task/node_modules/@prisma/client/runtime/library.js:177:2908
    at async /var/task/node_modules/@prisma/client/runtime/library.js:177:3123
    at async t._executeRequest (/var/task/node_modules/@prisma/client/runtime/library.js:177:10621)
    at async Careers (/var/task/.next/server/pages/api/careers/post_get.js:64:25) {
  clientVersion: '4.15.0',
  errorCode: undefined
}

我的架构本地化

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

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

datasource db {
  provider = "sqlite"
  url      = "file:../database/invensisdb.db"
}

model User {
  id        Int     @id @default(autoincrement())
  username     String  @unique
  password     String 
  createdAt DateTime @default(now())
}

model Job {
  id        Int     @id @default(autoincrement())
  location  String
  title     String
  description   String
  createdAt DateTime @default(now())
}

model JobApplication {
  id        Int     @id @default(autoincrement())
  email      String
  location   String
  startDate  String
  primarySkills  String
  createdAt DateTime @default(now())
}

model Projects {
  id        Int     @id @default(autoincrement())
  name     String
  location      String
  description     String
  duration     String
  createdAt DateTime @default(now())
}

rmbxnbpk

rmbxnbpk1#

基于此链接:SQLite support for Vercel
看起来Vercel不支持SQLite,他们建议使用Vercel Postgres作为替代方案。

相关问题