Issues connecting to the database

I'm trying to connect to my db using the new Postgres + Prisma setup. For some reason whenever I try to push or migrate I keep getting the message
Error: P1001: Can't reach database server at `us-east-1.sql.xata.sh:5432`

Please make sure your database server is running at `us-east-1.sql.xata.sh:5432`.
Error: P1001: Can't reach database server at `us-east-1.sql.xata.sh:5432`

Please make sure your database server is running at `us-east-1.sql.xata.sh:5432`.
I've used Postgres connections to other databases as well, and I've confirmed that the Postgres is enabled If it makes any difference, I'm using Prisma 5.17.0 on a Next.js 14.2.5 project. Any help is much appreciated, thank you!
7 Replies
kostas
kostas2mo ago
Hi, what is your PosgreSQL endpoint?(without the API key part) You can get that from the Settings page of Postgres-enabled databases. Have you configured it in the datasource as url as shown in the docs here? (https://xata.io/docs/integrations/prisma#usage) Have you created a Shadow Database as well, as this is necessary for migrations https://xata.io/docs/integrations/prisma#shadow-database-for-migrations)
Condo's Sugar Baby
postgresql://gptgfo:<YOUR_API_KEY>@us-east-1.sql.xata.sh/Easy-Shops:main?sslmode=require I hadn't tried making a shadow database yet, trying that right now
kostas
kostas2mo ago
There are no SQL requests arriving to your database so it looks like things break before even establishing a connection. Try adding the shadow database (which is an additional one to hold migrations) and in case that doesn't work, please enable the "Allow support to view your workspace" option from Workspace Settings so we can get access and check if everything works well
Condo's Sugar Baby
The shadow database doesn't seem to have worked, I just enabled the "Allow support to view your workspace" option
kostas
kostas2mo ago
Verified the database itself works well. We don't see any requests coming in to the PostgreSQL endpoint from your Prisma client though. - Can you double check your API key configured with Prisma is correct, by connecting with another tool such as the command line tool psql psql 'postgresql://gptgfo:xau_...@us-east-1.sql.xata.sh:5432/Easy-Shops:main?sslmode=require' ? - If that doesn't work either, it would be a connectivity issue such as a VPN or host firewall blocking the target port
Condo's Sugar Baby
I got it! It seems there was an issue with the API Key, so sorry for the inconvenience
kostas
kostas2mo ago
Ah nice! No worry at all, I am glad things worked
Want results from more Discord servers?
Add your server