Invalid `prisma.job.findMany()` invocation: Database Path error while using SQL Lite connecting to my database on Vercel

huangapple go评论77阅读模式
英文:

Invalid `prisma.job.findMany()` invocation: Database Path error while using SQL Lite connecting to my database on Vercel

问题

我在尝试访问我的Next.js应用程序上加载数据的页面时遇到了504内部服务器错误。错误消息如下:

检索用户时出错:PrismaClientInitializationError:
无效的 `prisma.job.findMany()` 调用:

查询数据库时出错:无法打开数据库文件:

根据我理解,它无法打开数据库,我不确定是否是路径的问题。在本地,路径正常运行。我正在使用Prisma来连接数据库。

我该如何修复这个问题?

这是在Vercel日志中的完整错误:

检索用户时出错:PrismaClientInitializationError:
无效的 `prisma.job.findMany()` 调用:

查询数据库时出错:无法打开数据库文件:/var/task/node_modules/.prisma/client/../database/invensisdb.db
在 /var/task/node_modules/@prisma/client/runtime/library.js:174:7205 处处理请求错误
在 /var/task/node_modules/@prisma/client/runtime/library.js:174:6358 处处理和记录请求错误
在 /var/task/node_modules/@prisma/client/runtime/library.js:177:2908 处
在 async /var/task/node_modules/@prisma/client/runtime/library.js:177:3123 处
在 async t._executeRequest (/var/task/node_modules/@prisma/client/runtime/library.js:177:10621 处)
在 async Careers (/var/task/.next/server/pages/api/careers/post_get.js:64:25 处)
{
  clientVersion: '4.15.0',
  errorCode: undefined
}

我的本地模式:

// 这是您的Prisma模式文件,
// 了解更多信息: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())
}

Invalid `prisma.job.findMany()` invocation: Database Path error while using SQL Lite connecting to my database on Vercel

英文:

I am getting a 504 internal server error while trying to access a page which loads data on my next.js application. The error states:

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

Error querying the database: unable to open database file:

From what I understand it's no opening the database and I'm not sure if it's the path. locally the path is working and running fine. I am using prisma to connect to the database.

How can I fix this?

This is the full error on vercel log:

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
}

My Schema Locally

// 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())
}

Invalid `prisma.job.findMany()` invocation: Database Path error while using SQL Lite connecting to my database on Vercel

答案1

得分: 1

根据这个链接: Vercel对SQLite的支持

看起来Vercel不支持SQLite,并推荐使用 Vercel Postgres 作为替代方案。

英文:

Based on this Link: SQLite support for Vercel

It looks like SQLite isn't supported by Vercel, and they recommend using Vercel Postgres as an alternative.

huangapple
  • 本文由 发表于 2023年6月16日 02:59:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76484754.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定