Error: Schema engine error:

I'm trying to integrate supabase with prisma but getting the following error:
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "aws-1-us-east-1.pooler.supabase.com:5432"

Error: Schema engine error:
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "aws-1-us-east-1.pooler.supabase.com:5432"

Error: Schema engine error:
33 Replies
gabriel
gabrielOP7d ago
Please help me to fix this error. I'm not sure what the error is... Here's my schema.prisma:
generator client {
provider = "prisma-client-js"
output = "../generated/prisma"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}

model Post {
id Int @id @default(autoincrement())
title String
content String?
published Boolean @default(false)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
}

model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
}
generator client {
provider = "prisma-client-js"
output = "../generated/prisma"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}

model Post {
id Int @id @default(autoincrement())
title String
content String?
published Boolean @default(false)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
}

model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
}
garyaustin
garyaustin7d ago
Is there more errror info. That error is only seen once here with Prisma and was relayed with a more detailed connection error. Guides: https://supabase.com/docs/guides/database/prisma https://supabase.com/docs/guides/database/prisma/prisma-troubleshooting Make sure you connection URL is correct including using postgres.instanceid for the username and no special characters in the password.
gabriel
gabrielOP7d ago
Here's my env file
DATABASE_URL=postgresql://postgres.project_id:[email protected]:6543/postgres?pgbouncer=true

# Direct connection to the database. Used for migrations
DIRECT_URL=postgresql://postgres.project_id:[email protected]:5432/postgres
DATABASE_URL=postgresql://postgres.project_id:[email protected]:6543/postgres?pgbouncer=true

# Direct connection to the database. Used for migrations
DIRECT_URL=postgresql://postgres.project_id:[email protected]:5432/postgres
And there isn't any more error I followed the docs and everything is from docs
garyaustin
garyaustin7d ago
If you password does not contain special characters and your instance is in US east those look correct.
gabriel
gabrielOP7d ago
I've just created the project on supabase I don't have any special characters or number on my password Is there any other configuration on supabase?
garyaustin
garyaustin7d ago
Wait. Are your URL's backwards?
gabriel
gabrielOP7d ago
the env variables are also from supabase
garyaustin
garyaustin7d ago
Yeah, the connect tab shows like you have.
gabriel
gabrielOP7d ago
Is that something wrong?
garyaustin
garyaustin7d ago
For serverless prisma clients
No description
gabriel
gabrielOP7d ago
It looks same as mine
garyaustin
garyaustin7d ago
I don't know of any other settings and most Prisma users here get a connection error and not this "schema engine error". I've never seen that but there is one hit in the search here from awhile back. You'll have to see if a Prisma user comes along. Your settings seem correct for serverless.
gabriel
gabrielOP7d ago
I created a "prisma" user as well by following this:
No description
gabriel
gabrielOP7d ago
Same error with "prisma"
garyaustin
garyaustin7d ago
You used postgres user in your code you showed. So would need the DB password.
gabriel
gabrielOP7d ago
I have db password too
garyaustin
garyaustin7d ago
So you tried both users?
gabriel
gabrielOP7d ago
Yes tried both and same error
garyaustin
garyaustin7d ago
The Postgres one with the DB password should work.
gabriel
gabrielOP7d ago
I think it looks like connection error. Is there any way to check that url manually?
garyaustin
garyaustin7d ago
PSQL is a db tool you can install with locally with a local Postgres and can test it. Do you see something that says connection error?
gabriel
gabrielOP7d ago
Can I test DATABASE_URL (port 6543) on pgAdmin?
garyaustin
garyaustin7d ago
Not sure. I know you can test the 5432 port. If that works the other would too. I've never used the pooler transaction port with a DB tool. There are no known issues with Prisma and Supabase.
gabriel
gabrielOP7d ago
No description
garyaustin
garyaustin7d ago
user name is wrong needs the project id. postgres.projectid
gabriel
gabrielOP7d ago
No description
gabriel
gabrielOP7d ago
Is this correct?
garyaustin
garyaustin7d ago
No idea what you are doing now. The connection tab should have the values.
garyaustin
garyaustin7d ago
No description
garyaustin
garyaustin7d ago
I see. You changed the host name not the username. So from you last screen prisma.xxxxxxxxxxxxx is the username.
gabriel
gabrielOP7d ago
Yes, it's working. I think it's prisma error Not sure what's wrong with prisma...
garyaustin
garyaustin7d ago
No idea. See if they have a forum or see if a Prisma user comes along here.
gabriel
gabrielOP7d ago
Anyway, thanks for your support!

Did you find this page helpful?