I have a nextjs project that's using prismaDB for the ORM. I'm able to connect just fine to my local postgres db but I'm getting this error when running npx prisma migrate
.
Error: P1001: Can't reach database server at db-name.*.us-west-2.rds.amazonaws.com
:5432
.
schema.prisma:
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
//url = "postgresql://master_username:master_password@aws_host:5432/db_name"
}
The RDS db is currently public and I'm positive that I've copied over the RDS credentials correctly. There doesn't seem to be anything I should be including for the connection to work but I'm not getting any other info as to why I can't reach the db server.
CodePudding user response:
Seems like you have to replace db-name.*.us-west-2.rds.amazonaws.com
with the name of your actual database, unless you replaced it for the purpose of asking this question. Specifically the part where it says db-name.*
.
Docs: https://www.prisma.io/docs/reference/api-reference/error-reference#common
P1001
indicates that it couldn't find the database given the connection string, NOT necessarily that the credentials you provided were wrong. Make sure you're specifying the correct database name/host and whatever else you need to make it work for AWS.
CodePudding user response:
Somehow I was able to connect to RDS after deleting and creating a new DB for the third time. I confirmed connection through pgAdmin then tried it again my app deployed to vercel.