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 not 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())
}
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.