英文:
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())
}
英文:
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())
}
答案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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论