Can't reach database server at localhost:5432
PostgreSQL 16, I'm implementing OpenAPI on Cloudfare Workers using TypeScript, I did an endpoint and it shows an error
PrismaClientKnownRequestError: Invalid
prisma.clientProfile.create()
invocation: This request could not be understood by the server:
{"type":"UnknownJsonError","body":{"code":"P6008","message":"Accelerate was not able to connect to
your database. The underlying error is: Can't reach database server at localhost:5432
\n\nPlease
make sure your database server is running at localhost:5432
."}}
I don't understand what the error is because my seeding is working correctly, the whole database setup seems to be correct, next I will give more input from my app
Endpoint:
schema:
../../prisma/prisma:
.env:
DIRECT_DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres?schema=public"
DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=apikey"
When using endpoint, in my pgAdmin 4 database I see activity from connections, the correct link is connected to my database in Accelerate, but I get this error.
my seed.ts, which works just fine:
Open to any discussion, I really want to get this fixed. Thank you!2 Replies
values in the seed array are filled with examples, I made the dots like '...', to avoid the character limit
Hey @Alexcitten
Prisma Accelerate needs a hosted database. It cannot connect to a database running locally on localhost.
Are you using something like https://ngrok.com/?
ngrok | API Gateway, IoT Device Gateway, Secure Tunnels for Contain...
ngrok is a secure ingress platform that enables developers to add global server load balancing, reverse proxy, firewall, API gateway and Kubernetes Ingress to applications and APIs.