Replies: 2 comments 5 replies
-
|
first why it is 404 are you using local prisma postgres instance or cloud prisma postgres? |
Beta Was this translation helpful? Give feedback.
-
|
It might be worth checking your SSL config. I found that the command line (e.g. This code tells the PG client not to worry about checking the Postgres server's SSL/TLS cert. This isn't recommended for production, but for localhost/dev it would at least verify that SSL handshaking is the problem. const adapter = new PrismaPg({
connectionString: process.env.DATABASE_URL,
ssl: {
rejectUnauthorized: false,
},
});
const prisma = new PrismaClient({
adapter,
}); |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Question
I'm using pg local with prisma.
I'm getting this error if I go to the dashboard page:
next git:(main) ✗ pnpm run dev
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update:
npm i baseline-browser-mapping@latest -D▲ Next.js 16.0.5 (Turbopack)
✓ Starting...
✓ Ready in 1528ms
○ Compiling / ...
GET / 200 in 4.4s (compile: 4.0s, render: 407ms)
GET /api/user 404 in 744ms (compile: 554ms, render: 190ms)
Error fetching users: Error [PrismaClientKnownRequestError]:
Invalid
__TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$prisma$2e$ts__$5b$app$2d$rsc$5d$__$28$ecmascript$29$__["default"].user.findMany()invocation in/home/makima/Documents/Info/next/.next/dev/server/chunks/ssr/[root-of-the-server]__b87aad6c._.js:304:155
301 ;
302 async function getUsers() {
303 try {
→ 304 const users = await TURBOPACK__imported__module$5b$project$5d2f$lib$2f$prisma$2e$ts__$5b$app$2d$rsc$5d$$28$ecmascript$29$["default"].user.findMany(
Operation has timed out
at (app/api/user.ts:5:37)
at async getUsers (app/api/user.ts:5:19)
at async Dashboard (app/dashboard/page.tsx:4:17)
3 | export default async function getUsers() {
4 | try {
301 ;
302 async function getUsers() {
303 try {
→ 304 const users = await {imported module ./lib/prisma.ts}["default"].user.findMany(
Operation has timed out
at (app/api/user.ts:5:37)
at async getUsers (app/api/user.ts:5:19)
at async Dashboard (app/dashboard/page.tsx:4:17)
3 | export default async function getUsers() {
4 | try {
users.ts:
import prisma from '@/lib/prisma';
async function getUsers() {
try {
console.log('Fetching users...');
const users = await prisma.user.findMany();
console.log('Users fetched:', users);
return users;
} catch (error) {
console.error('Error fetching users:', error);
throw error;
}
}
getUsers();
dashboard.page.tsx:
import getUsers from '../api/user';
export default async function Dashboard() {
const users = await getUsers();
return (
);
}
But seed works just fine: pnpm dlx prisma db seed
info=# \d
List of relations
Schema | Name | Type | Owner
--------+--------------------+-------+--------
public | User | table | makima
public | _prisma_migrations | table | makima
(2 rows)
info=# SELECT * from "User";
id | email | name | password | createdAt | updatedAt
----+-------+------+----------+-----------+-----------
(0 rows)
info=# SELECT * from "User";
id | email | name |
password | createdAt |
updatedAt
--------------------------------------+-----------------+-------+----------------------------------
-----------------------------------------------------------------+-------------------------+-------
51752ed5-d841-455f-82dc-e51655260234 | [email protected] | Admin | $argon2id$v=19$m=65536,t=3,p=4$Vi
How1DcxOo7QRHoGzNxJg$Sz43SEbk5hdZvJhqIuW7eITQ9XG0+zVy4l/zScE38y4 | 2025-11-28 14:50:26.772 | 2025-1
1-28 14:50:26.772
b416bf1e-8e78-4528-b130-ffee993eff87 | [email protected] | Bob | $argon2id$v=19$m=65536,t=3,p=4$f3
iS99mkAlvRYhw9E1NBeA$1nZQ34kPRueaR4QNMKr4leGRTVK3FwsgVjoThGOLry8 | 2025-11-28 14:50:26.916 | 2025-1
1-28 14:50:26.916
(2 rows)
And if I change user.ts a bit:
import prisma from '@/lib/prisma';
async function getUsers() {
try {
console.log('Fetching users...');
const users = await prisma.user.findMany();
console.log('Users fetched:', users);
return users;
} catch (error) {
console.error('Error fetching users:', error);
throw error;
}
}
getUsers();
And run: pnpm tsx ./app/api/user.ts
Then I get:
Fetching users...
Error fetching users: PrismaClientKnownRequestError:
Invalid
prisma.user.findMany()invocation in/home/makima/Documents/Info/next/app/api/user.ts:6:37
3 async function getUsers() {
4 try {
5 console.log('Fetching users...');
→ 6 const users = await prisma.user.findMany(
The table
public.Userdoes not exist in the current database.at $r.handleRequestError (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client/src/runtime/RequestHandler.ts:228:13)
at $r.handleAndLogRequestError (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client/src/runtime/RequestHandler.ts:174:12)
at $r.request (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client/src/runtime/RequestHandler.ts:143:12)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async a (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client/src/runtime/getPrismaClient.ts:766:24)
at async getUsers (/home/makima/Documents/Info/next/app/api/user.ts:6:19) {
code: 'P2021',
meta: {
modelName: 'User',
driverAdapterError: DriverAdapterError: TableDoesNotExist
at PrismaPgAdapter.onError (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]/node_modules/@prisma/adapter-pg/dist/index.js:693:11)
at PrismaPgAdapter.performIO (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]/node_modules/@prisma/adapter-pg/dist/index.js:688:12)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async PrismaPgAdapter.queryRaw (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]/node_modules/@prisma/adapter-pg/dist/index.js:608:30)
at async (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client-engine-runtime/src/tracing.ts:68:22)
at async mr (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client-engine-runtime/src/tracing.ts:56:10)
at async e.interpretNode (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client-engine-runtime/src/interpreter/query-interpreter.ts:175:26)
at async e.interpretNode (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client-engine-runtime/src/interpreter/query-interpreter.ts:261:41)
at async e.run (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client-engine-runtime/src/interpreter/query-interpreter.ts:83:23)
at async e.execute (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client/src/runtime/core/engines/client/LocalExecutor.ts:75:12) {
cause: [Object]
}
},
clientVersion: '7.0.1'
}
node:internal/process/promises:394
triggerUncaughtException(err, true /* fromPromise */);
^
PrismaClientKnownRequestError:
Invalid
prisma.user.findMany()invocation in/home/makima/Documents/Info/next/app/api/user.ts:6:37
3 async function getUsers() {
4 try {
5 console.log('Fetching users...');
→ 6 const users = await prisma.user.findMany(
The table
public.Userdoes not exist in the current database.at $r.handleRequestError (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client/src/runtime/RequestHandler.ts:228:13)
at $r.handleAndLogRequestError (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client/src/runtime/RequestHandler.ts:174:12)
at $r.request (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client/src/runtime/RequestHandler.ts:143:12)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async a (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client/src/runtime/getPrismaClient.ts:766:24)
at async getUsers (/home/makima/Documents/Info/next/app/api/user.ts:6:19) {
code: 'P2021',
meta: {
modelName: 'User',
driverAdapterError: DriverAdapterError: TableDoesNotExist
at PrismaPgAdapter.onError (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]/node_modules/@prisma/adapter-pg/dist/index.js:693:11)
at PrismaPgAdapter.performIO (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]/node_modules/@prisma/adapter-pg/dist/index.js:688:12)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async PrismaPgAdapter.queryRaw (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]/node_modules/@prisma/adapter-pg/dist/index.js:608:30)
at async (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client-engine-runtime/src/tracing.ts:68:22)
at async mr (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client-engine-runtime/src/tracing.ts:56:10)
at async e.interpretNode (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client-engine-runtime/src/interpreter/query-interpreter.ts:175:26)
at async e.interpretNode (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client-engine-runtime/src/interpreter/query-interpreter.ts:261:41)
at async e.run (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client-engine-runtime/src/interpreter/query-interpreter.ts:83:23)
at async e.execute (/home/makima/Documents/Info/next/node_modules/.pnpm/@prisma[email protected]_prisma@7.0.1_@types[email protected]_react-dom@[email protected]__re_6bc95346ce983164bf43b9b4fbc1fdfe/node_modules/@prisma/client/src/runtime/core/engines/client/LocalExecutor.ts:75:12) {
cause: {
originalCode: '42P01',
originalMessage: 'relation "public.User" does not exist',
kind: 'TableDoesNotExist',
table: 'public.User'
}
}
},
clientVersion: '7.0.1'
}
Node.js v22.18.0
Also:
next git:(main) ✗ pnpm dlx prisma generate
Loaded Prisma config from prisma.config.ts.
Prisma schema loaded from prisma/schema.prisma
✔ Generated Prisma Client (7.0.1) to ./generated/prisma in 86ms
next git:(main) ✗ pnpm dlx prisma migrate dev
Loaded Prisma config from prisma.config.ts.
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "info", schema "public" at "localhost:5432"
Already in sync, no schema change or pending migration was found.
And studio also shows that there's a seeded User table.
Any idea how to resolve this?
How to reproduce (optional)
Follow this: https://www.prisma.io/docs/guides/nextjs
Except schema is different and I use pnpm.
Expected behavior (optional)
It should fetch without problem.
Information about Prisma Schema, Client Queries and Environment (optional)
OS: Arch Linux
Database: PostgresSQL 18.1
Node.js version: v22.18.0
prisma : 7.0.1
@prisma/client : 7.0.1
prisma.config.ts
seed.ts
Beta Was this translation helpful? Give feedback.
All reactions